Exemplo n.º 1
0
 private void StartFleeing()
 {
     if (this.behavior != null)
     {
         this.behavior.SetWeight(0f, this.wanderGoal);
         this.behavior.SetWeight(1f, this.fleeGoal);
         this.behavior.SetWeight(0.4f, this.centerGoal);
         this.state = ScaredState.Flee;
     }
 }
Exemplo n.º 2
0
        private void HandleEnemyResponse(Character character, SCNNode enemy)
        {
            var direction = enemy.WorldPosition - character.Node.WorldPosition;

            if (direction.Length < 0.5f)
            {
                if (character.IsAttacking)
                {
                    this.state = ScaredState.Dead;

                    character.DidHitEnemy();

                    this.PerformEnemyDieWithExplosion(enemy, direction);
                }
                else
                {
                    character.WasTouchedByEnemy();
                }
            }
        }