Eye of the Nile Docs
Everything you need to know to get started!
Loading...
Searching...
No Matches
RangedEntityController Class Reference

Detailed Description

Functionality for entities with a ranged attack. Inherits from BaseEntityController.

Documentation updated 8/26/2024

Author
Roy Pascual

Public Attributes

GameObject projectilePrefab
 The projectile this entity will shoot.
 

Protected Member Functions

override void ActivateAttack ()
 Instantiates a new projectile and flips it to face the right direction.
 
override void TriggerAttack ()
 
override void CloseAttackState ()
 
- Protected Member Functions inherited from BaseEntityController
void ActivateAttack ()
 Triggered by an event in the attack animation (or you can override TriggerAttack() if there is not attack animation). This function muse be overridden by any inheriting class.
 
virtual void PatrolState ()
 When the entity hasn't detected any enemies...
 
virtual void ChaseState ()
 If the entity has detected an enemy...
 

Additional Inherited Members

- Public Member Functions inherited from BaseEntityController
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.
 
- Protected Attributes inherited from BaseEntityController
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.
 
- Properties inherited from BaseEntityController
EntityState EState = EntityState.Patrol [get, protected set]
 Current state the entity is in.
 

Member Function Documentation

◆ ActivateAttack()

override void RangedEntityController.ActivateAttack ( )
protected

Instantiates a new projectile and flips it to face the right direction.

◆ CloseAttackState()

override void RangedEntityController.CloseAttackState ( )
protectedvirtual

Modified from the base version so entity flips direction if target moves behind it

Todo
Make entityCenter offest a variable rather than hard coded.

Reimplemented from BaseEntityController.

◆ TriggerAttack()

override void RangedEntityController.TriggerAttack ( )
protectedvirtual

Plays the attack animation and runs ActivateAttack().

Note
The attack animation for the Seth Follower fires the arrow immediately, so just calling ActivateAttack() immediately is ok.

Reimplemented from BaseEntityController.

Member Data Documentation

◆ projectilePrefab

GameObject RangedEntityController.projectilePrefab

The projectile this entity will shoot.


The documentation for this class was generated from the following file: