Jagguar Game Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ProjectileComponent Class Reference

#include <ProjectileComponent.hpp>

Inheritance diagram for ProjectileComponent:
Inheritance graph
[legend]
Collaboration diagram for ProjectileComponent:
Collaboration graph
[legend]

Public Member Functions

 ProjectileComponent (RigidbodyComponent *_projectile, TransformComponent *_target, bool _homing, float _var)
 
 ~ProjectileComponent ()
 
void Update (SDL_Event e, int frame, std::vector< std::string > broadcastList) override
 
void Render (SDL_Renderer *ren) override
 
- Public Member Functions inherited from Component
 Component ()
 
 ~Component ()
 
virtual void Update (SDL_Event e, int frame, std::vector< std::string > broadcastList)
 
virtual void Render (SDL_Renderer *ren)
 
virtual void ShowComponentEditor (bool *showEditor)
 
virtual bool HasTag (ComponentTag t)
 
virtual const char * ComponentTypeName ()
 
void ParseAndUpdateBroadcast (std::vector< std::string > broadcastList)
 

Private Attributes

RigidbodyComponentprojectile
 
TransformComponenttarget
 
bool homing
 
float speed
 
float angle
 
float gravity = 10
 

Additional Inherited Members

- Protected Attributes inherited from Component
std::vector< ComponentTag > tags
 
std::vector< std::string > previousBroadcasts
 
std::vector< std::string > pendingBroadcasts
 

Detailed Description

A Component implementation to treat a GameObject as a projectile.

Constructor & Destructor Documentation

◆ ProjectileComponent()

ProjectileComponent::ProjectileComponent ( RigidbodyComponent _projectile,
TransformComponent _target,
bool  _homing,
float  _var 
)

Construct a new Projectile Component object.

Parameters
_projectilethe RigidbodyComponent of the parent GameObject
_targetthe TransformComponent of the target the Projectile is fired at
_homingwhether the ProjectileComponent will seek out the target
_varif homing, the speed of the projectile. Otherwise, the angle the ProjectileComponent is fired at
Here is the call graph for this function:

◆ ~ProjectileComponent()

ProjectileComponent::~ProjectileComponent ( )

Destroy the Projectile Component object

Member Function Documentation

◆ Render()

void ProjectileComponent::Render ( SDL_Renderer *  ren)
overridevirtual

Renders the component (if it has anything to render)

Parameters
renthe SDL renderer to be displayed upon
See also
IGraphicsEngineRenderer

Reimplemented from Component.

◆ Update()

void ProjectileComponent::Update ( SDL_Event  e,
int  frame,
std::vector< std::string >  broadcastList 
)
overridevirtual

Updates the state of the component object. Called by the Engine every tick

Parameters
eany inputs given by the user
framewhat frame is the game currently displaying
broadcastLista list to be used to send messages between components
See also
ParseAndUpdateBroadcast()

Reimplemented from Component.

Here is the call graph for this function:

Member Data Documentation

◆ homing

bool ProjectileComponent::homing
private

the TransformComponent being attacked


The documentation for this class was generated from the following files: