/// <summary>
 ///
 /// </summary>
 void Start()
 {
     // Atribui o estado inicial caso seja valido.
     if (initialState == null || initialState.gameObject != gameObject)
     {
         Debug.LogError("No initial state.");
     }
     else
     {
         state    = initialState;
         moving   = GetComponent <EnemyMoving>();
         shooting = GetComponent <EnemyShooting>();
         dying    = GetComponent <EnemyDying>();
     }
 }
示例#2
0
文件: Enemy.cs 项目: T-era/CShappy
 public void Crush(Field field)
 {
     if (dying == EnemyDying.Fine)
     {
         dying = EnemyDying.Dying;
     }
     else if (dying == EnemyDying.Dying)
     {
         dying  = EnemyDying.Die;
         height = 1;
         Y++;
     }
     else if (dying == EnemyDying.Die)
     {
         field.Score += this.Score;
         field.Remove(this);
     }
 }
示例#3
0
 private void OnEnemyDying(Enemy enemy, float enemyHealthReward)
 {
     enemy.Dying -= OnEnemyDying;
     EnemyDying?.Invoke(enemyHealthReward);
     enemy.gameObject.SetActive(false);
 }