Hittable
This component represents basic class of hittable entity (entity with HP, which can get damage, can be healed and killed).
We recommend to use it as base class for your characters in case if that characters should be able to get damage.
Protected fields (can be used from inherited class)
Current health of hittable entity.
Max health of hittable entity.
Team of this hittable object. TeamType.None
by default.
Available methods
This method assigns hittable object to certain team.
This method returns hit transform if this hittable. By default, its own transform is returned. Can be used for targeting enemy projectiles to this hittable entity.
This method inflicts certain amount of damage to this hittable entity.
This method applies certain amount of healing to this hittable entity.
Instantly kills hittable entity.
Resets current health to max value.
Returns true in case if entity is dead, otherwise false.
Returns current percentage of HP.
Returns current amount of HP.
Returns max amount of HP.
This method adds listener to damage got event. If entity gets damage, given listener will be invoked.
Example:
This method adds listener to healing got event. If entity gets healing, given listener will be invoked.
This method adds listener to death event. If entity dies, given listener will be invoked.
Last updated