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

Detailed Description

Functionality for Geb's rock golems. Inherits from MeleeEntityController, which inherits from BaseEntityController. What changed:

  • The golems can also damage walls, not just player. (Modification to ActivateAttack())
  • If a wall gets in the way of the golem chasing the player, the golem will attack the wall. (Modification to ChaseState())

Documentation updated 1/13/2025

Author
Alexander Art

Public Member Functions

void SpawnParticlesOnDeath ()
 
- 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.
 

Public Attributes

Transform boulderParticles
 Particles the golem will spawn when it dies.
 
- Public Attributes inherited from MeleeEntityController
float attackRange = 0.5f
 The distance from the attack point that enemies will be hit (size of attack point).
 
float knockback = 75f
 The strength of the knockback that the attack will apply.
 
bool knockbackEnabled = true
 If true, the melee attack will apply knockback to the attacked object.
 

Protected Member Functions

override void ChaseState ()
 Similar to base.ChaseState except for attackLayers also detected.
 
override void ActivateAttack ()
 When the attack is activated, scan for the player and any walls. Then, apply damage (and knockback, if its the player).
 
- Protected Member Functions inherited from MeleeEntityController
override void ActivateAttack ()
 Scan the attack range for enemies, and apply damage and knockback (if enabled)
 
override void TriggerAttack ()
 Trigger attacking animation.
 
- 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 CloseAttackState ()
 If the entity is close enough to an enemy to attack...
 

Protected Attributes

LayerMask attackLayers
 The rock golem does not chase objects on these layers, but will attack them if they are in their way of chasing.
 
- 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.
 

Additional Inherited Members

- Properties inherited from BaseEntityController
EntityState EState = EntityState.Patrol [get, protected set]
 Current state the entity is in.
 

Member Function Documentation

◆ ActivateAttack()

override void RockGolemController.ActivateAttack ( )
protected

When the attack is activated, scan for the player and any walls. Then, apply damage (and knockback, if its the player).

◆ ChaseState()

override void RockGolemController.ChaseState ( )
protectedvirtual

Similar to base.ChaseState except for attackLayers also detected.

Reimplemented from BaseEntityController.

◆ SpawnParticlesOnDeath()

void RockGolemController.SpawnParticlesOnDeath ( )

Member Data Documentation

◆ attackLayers

LayerMask RockGolemController.attackLayers
protected

The rock golem does not chase objects on these layers, but will attack them if they are in their way of chasing.

◆ boulderParticles

Transform RockGolemController.boulderParticles

Particles the golem will spawn when it dies.


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