Package com.csse3200.game.components.npc
Class DeflectingComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.npc.DeflectingComponent
A component that deflects incoming projectiles a set amount of projectile
collision events.
The target layer to be deflected is flexible, meaning it can deflect other
entities as well, including but not limited to it's own target layer.
This class assumes the projectile has only a TrajectTask. If there are multiple tasks, the other tasks will be disposed.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDeflectingComponent
(short targetLayer, short dmgLayer, int deflectLimitAmount) Initialise a Deflecting component that deflects projectile, reversing the incoming direcition of the entity. -
Method Summary
Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
DeflectingComponent
public DeflectingComponent(short targetLayer, short dmgLayer, int deflectLimitAmount) Initialise a Deflecting component that deflects projectile, reversing the incoming direcition of the entity. Any effects, such as damage, will be negated when deflected. The projectile's damage target layer will also be changed.- Parameters:
targetLayer
- Target layer to deflect ondmgLayer
- Target layer for the projectile to hit.deflectLimitAmount
- Amount of deflections to occur for the disabling of this component.
-
-
Method Details
-
create
public void create()Description copied from class:Component
Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished. -
update
public void update()Description copied from class:Component
Called once per frame of the game, and should be used for most component logic. Not called if component is disabled.
-