Class PlayerTouchAttackComponent


public class PlayerTouchAttackComponent extends TouchAttackComponent
  • Constructor Details

    • PlayerTouchAttackComponent

      public PlayerTouchAttackComponent(short targetLayer)
      Create a component which attacks enemy entities on collision, without knockback.
      Parameters:
      targetLayer - The physics layer of the target's collider.
  • 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.
      Overrides:
      create in class TouchAttackComponent
    • 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.
      Overrides:
      update in class Component
    • setCombatAnimator

      public void setCombatAnimator(Entity combatAnimator)
      Sets the combat item animator for this actions component
      Parameters:
      combatAnimator - the combat animator entity which has subcomponents PlayerSkillAnimationController and AnimationRenderer
    • getCombatAnimator

      public Entity getCombatAnimator()
      Returns the combat item animator
      Returns:
      combat item animator
    • checkCanAttack

      public void checkCanAttack()
      Method called to check if the player can attack
    • playAttackSounds

      public void playAttackSounds(Entity weaponEquipped)
      Plays attack sounds for combat weapons dependent on the weapon in hand
      Parameters:
      weaponEquipped - The entity representing the weapon the player is currently holding
    • playAttackAnimation

      public void playAttackAnimation(Entity weaponEquipped, Entity auraEquipped)
      Plays attack animation dependent on weapon in hand
      Parameters:
      weaponEquipped - The entity representing the weapon the player is currently holding
      auraEquipped - The entity representing the aura that is currently active
    • attackWithPhysicalWeapon

      public void attackWithPhysicalWeapon(Entity weaponEquipped, Entity auraEquipped)
      Method to set attack cooldown and trigger attack animation dependent on the weapon and aura equipped
      Parameters:
      weaponEquipped - The entity representing the weapon the player is currently holding
      auraEquipped - The entity representing the aura that is currently active
    • attackWithNoWeapon

      public void attackWithNoWeapon()
      Method which sets the base cooldown to 4 seconds when attack with a fist
    • attackRanged

      public void attackRanged()
      Method triggered when the player is holding a ranged weapon, which creates the projectiles on the map