/// <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>(); } }
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); } }
private void OnEnemyDying(Enemy enemy, float enemyHealthReward) { enemy.Dying -= OnEnemyDying; EnemyDying?.Invoke(enemyHealthReward); enemy.gameObject.SetActive(false); }