Ability - digocorbellini/EGaDS-Open-Project GitHub Wiki

Description

The Ability abstract class is part of the Ability System. Ability is the base class of all abilities that define how the player moves. Abilities however, should not extend the Ability class but instead extend either the TriggeredAbility or the PassiveAbility classes. For more information on ability types, look at this section on Types of Abilities.

Ability inherits from ScriptableObject. Thus, by adding the CreateAssetMenu attribute, abilities can be attached to a game object in the inspector as an asset. (See Unity documentation for ScriptableObject for more info).

Properties

  • int SlotIndex: The slot index the ability is held in. If equal to -1, then the ability is not in a slot.
  • float SpeedMultiplier: Multiplier applied to player left-right movement speed, in tiles per second.
  • float FallSpeedMultiplier: Multiplier applied to the maximum speed the player falls at, in tiles per second.
  • float WallSlideMultiplier: Multiplier applied to the speed the player slides down while on a wall, in tiles per second.
  • float JumpHeightAddend: Number of tiles added to player jump height.
  • float AirJumpAddend: Number of extra jumps the player can perform in the air.

Protected Methods in TriggeredAbility

  • bool GetKeyCode(): Returns the hotkey corresponding to the ability.
  • bool GetKey(): Analogous to Input.GetKey() for the ability's hotkey.
  • bool GetKeyDown(): Analogous to Input.GetKeyDown() for the ability's hotkey.
  • bool GetKeyUp(): Analogous to Input.GetKeyUp() for the ability's hotkey.

Virtual Methods

  • void AbilityStart(PlayerComponents player): Called when the player obtains the ability. Once this is called, Update() and FixedUpdate() will begin to be called.
  • void AbilityUpdate(PlayerComponents player): Called every frame when the ability is held by the player.
  • void AbilityFixedUpdate(PlayerComponents player): Called every fixed frame-rate frame defined by the physics system. Useful for performing operations that are required to be performed at a fixed frequency not dependent on user frame rate.
  • void AbilityEnd(PlayerComponents player): Called when the player loses the ability.
⚠️ **GitHub.com Fallback** ⚠️