Пример #1
0
        public void EnemyDecision(Character character)
        {
            if (character.State == CharacterState.Hit || character.State == CharacterState.Down || character.State == CharacterState.Dead)
                return;
            //patterns
            if (currentPattern.Count == 0)
            {
                SelectTarget(character);
                SelectAction(patterns, character);
            }
            if (character.Target == null)
                character.SetTarget(character);
            if (enemyActionTime <= 0)
            {
                enemyActionTime = currentPattern[0].StartBehavior(this, character);
            }

            if(character.State != CharacterState.Acting)
                enemyActionTime -= Time.deltaTime;

            currentPattern[0].UpdateBehavior(this, character);
            if (enemyActionTime <= 0)
            {
                currentPattern[0].EndBehavior(this, character);
                currentPattern.RemoveAt(0);
            }
        }
Пример #2
0
 public void SelectTarget(Character c)
 {
     c.SetTarget(targetController.GetTarget());
     if (c.Target == null)
         c.SetTarget(c);
 }