Class WeaponControllerComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.Weapons.WeaponControllerComponent
- Direct Known Subclasses:
BoomerangController
,MeleeSwingController
,ProjectileController
,StaticController
Class to control the movement of weapons that have been spawned
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected WeaponConfig
protected float
protected final Entity
protected int
-
Constructor Summary
ConstructorsConstructorDescriptionWeaponControllerComponent
(WeaponConfig config, float attackDirection, Entity player) Class to store variables of a spawned weaponWeaponControllerComponent
(WeaponConfig config, float attackDirection, Entity player, int attackNum) Class to store variables of a spawned weapon -
Method Summary
Modifier and TypeMethodDescriptionprotected void
add_animations
(AnimationRenderComponent animator) Function to add animations based on standard animation configurations (Overidable)void
create()
Create class - implemented class implement initial weapon setup including adding required animations and controlling initial movement direction and animationprotected abstract void
initial_animation
(AnimationRenderComponent animator) Set intial animationprotected abstract void
Set initial positionprotected abstract void
Set initial rotation (defaults to attack direction)protected abstract void
move()
Update entity location every tickprotected com.badlogic.gdx.math.Vector2
positionInDirection
(float direction, float distance) Returns the game position in a given direction at a given distance relative to the player to center a given attack entityprotected abstract void
Update entity animation if requiredprotected abstract void
rotate()
Update entity rotation every tickvoid
update()
Function to control projectile movement once it has spawnedMethods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Field Details
-
config
-
remainingDuration
protected int remainingDuration -
currentRotation
protected float currentRotation -
player
-
attackNum
protected int attackNum
-
-
Constructor Details
-
WeaponControllerComponent
public WeaponControllerComponent(WeaponConfig config, float attackDirection, Entity player, int attackNum) Class to store variables of a spawned weapon -
WeaponControllerComponent
Class to store variables of a spawned weapon
-
-
Method Details
-
create
public void create()Create class - implemented class implement initial weapon setup including adding required animations and controlling initial movement direction and animation -
update
public void update()Function to control projectile movement once it has spawned -
add_animations
Function to add animations based on standard animation configurations (Overidable) -
initial_rotation
protected abstract void initial_rotation()Set initial rotation (defaults to attack direction) -
initial_position
protected abstract void initial_position()Set initial position -
initial_animation
Set intial animation- Parameters:
animator
- - animation component for the entity
-
rotate
protected abstract void rotate()Update entity rotation every tick -
move
protected abstract void move()Update entity location every tick -
reanimate
protected abstract void reanimate()Update entity animation if required -
positionInDirection
protected com.badlogic.gdx.math.Vector2 positionInDirection(float direction, float distance) Returns the game position in a given direction at a given distance relative to the player to center a given attack entity- Parameters:
direction
- direction the position should be indistance
- distance infront of the player- Returns:
- position in the given direction at the distance
-