Functionality for basic entities with a melee attack. Inherits from BaseEntityController.
Documentation updated 8/26/2024
- Author
- Stephen Nuttall
|
void | ChangeSpeed (float speedChange) |
| Speeds up or slows down the entity's movement speed. A negative value for speedChange will slow down the entity.
|
|
void | ChangeSpeed (float speedChange, float duration) |
| Temporarily speeds up or slows down the entity's movement speed. A negative value for speedChange will slow down the entity.
|
|
void | DestroyOnDeath () |
| Can be optionaly run by ObjectHealth.onDeath.
|
|
ObjectHealth | objectHealth |
| Reference to the object responsible for managing the player's health.
|
|
Transform | attackPoint |
| Reference to the entity's attack point. It's a point in space that's a child of the entity, existing some distance in front of it. Projectiles spawn from the attack point, and melee attacks scan for enemies to damage from a certain radius around it.
|
|
int | attackDamage = 30 |
| Amount of damage the entity's attack will deal.
|
|
float | attackCooldown = 0.8f |
| The amount of time between attacks.
|
|
float | cooldownEndTime = 0f |
| Amount of time until cooldown is over. Set to the current time + attackCooldown when the attack is triggered.
|
|
LayerMask | enemyLayers |
| Objects on these layers will be considered an enemy of this entity, and if detected, this entity will seek to attack. An object can be assigned to a layer in the Unity Editor from a drop down menu in the top right.
|
|
PatrolZone | patrolZone |
| A patrol zone is an object that has two points the entity will walk between if it does not detect an enemy.
|
|
float | horizontalDirection = 0f |
| Horizontal direction the entity is traveling in.
|
|
float | detectionRange = 6f |
| How far away the entity will detect an enemy from and start chasing.
|
|
float | activateAttackRange = 3f |
| How close the entity must be to an enemy to attack it.
|
|
float | entityCenter = 1.4f |
|
bool | hostileDetected = false |
| True if the entity has detected an enemy.
|
|
bool | hostileInCloseRange = false |
| True if the entity is close enough to an enemy to attack it.
|
|
Rigidbody2D | rb |
| Reference to the entity's rigidbody.
|
|
float | moveVelocity = 6.0f |
| How fast the entity should move.
|
|
float | speedModifier = 0f |
| The precent of moveVelocity the entity should move at. Used for slowing the entity down.
|
|
float | linearDrag = 1.0f |
| Amount of drag to apply to the rigidbody.
|
|
float | groundedRaycastLength = 1.8f |
|
GroundDetector | groundDetector |
| Reference to the entity's GroundDetector.
|
|
bool | groundNeeded = true |
| Can be set to false to let the entity walk even when it is not on the ground.
|
|
bool | canWalk = true |
| Used for disabling entity movement.
|
|
Animator | animator |
| Reference to the entity's animator.
|
|
EntityState | EState = EntityState.Patrol [get, protected set] |
| Current state the entity is in.
|
|