public override void Update(Entity entity) { if (CollisionRay.IsEntityInSight(entity as Enemy, GameWorld.GetPlayers()[0])) { _jumpTimer.ChangeWaitTime(TimeBetweenJumps_ACTIVE); _canSeePlayer = true; } else { _jumpTimer.ChangeWaitTime(TimeBetweenJumps_IDLE); _canSeePlayer = false; } base.Update(entity); }
public override void Update(Entity entity) { if (CollisionRay.IsEntityInSight(entity, GameWorld.GetPlayers()[0]) && !isAngry) { isAngry = true; chargeUpTimer.ResetAndWaitFor(1000); entity.IsFacingRight = !entity.IsPlayerToTheRight(); } if (isAngry) { if (!firingUp) { firingUp = true; entity.AddAnimationToQueue("angry"); entity.Sounds.GetSoundRef("scream").PlayIfStopped(); entity.Sounds.GetSoundRef("fire").PlayIfStopped(); } } if (firingUp) { chargeUpTimer.Increment(); entity.Sounds.GetSoundRef("fire").PlayIfStopped(); } if (isRunningToPlayer) { chargeUpTimer.Reset(); entity.AddAnimationToQueue("charge"); entity.Sounds.GetSoundRef("fire").PlayIfStopped(); if (playerToRightWhenAngry) { entity.SetVelX(5); } else { entity.SetVelX(-5); } entity.IsFacingRight = !playerToRightWhenAngry; } base.Update(entity); }
public override void Update(Entity entity) { StoneGolem golem = entity as StoneGolem; if (CollisionRay.IsEntityInSight(entity, GameWorld.GetPlayers()[0])) { float velX = 1.0f; golem.IsFacingRight = false; if (!golem.IsPlayerToTheRight()) { velX *= -1; golem.IsFacingRight = true; } golem.SetVelX(velX); entity.AddAnimationToQueue("walk"); } else { entity.RemoveAnimationFromQueue("walk"); } base.Update(entity); }