Esempio n. 1
0
 public void ConsumeEvent(IEvent e)
 {
     if (e.GetType() == typeof(EnemyCurrentHealthEvent))
     {
         if (!transitioning)
         {
             EnemyCurrentHealthEvent currentHealthEvent = e as EnemyCurrentHealthEvent;
             SetHealth(currentHealthEvent.currentHealth);
             SetDisplayHealth(Mathf.CeilToInt(currentHealthEvent.currentHealth));
         }
     }
     else if (e.GetType() == typeof(EnemyMaxHealthEvent))
     {
         EnemyMaxHealthEvent maxHealthEvent = e as EnemyMaxHealthEvent;
         SetMaxHealth(maxHealthEvent.maxHealth);
     }
     else if (e.GetType() == typeof(EnemyStartingDataEvent))
     {
         EnemyStartingDataEvent startingDataEvent = e as EnemyStartingDataEvent;
         this.maxPhase = startingDataEvent.maxPhase;
         AddExtraBars();
     }
     else if (e.GetType() == typeof(EnemyHealthTransitionEvent))
     {
         EnemyHealthTransitionEvent transitionEvent = e as EnemyHealthTransitionEvent;
         StartCoroutine(PhaseTransitionHealth(transitionEvent.duration, transitionEvent.nextPhase));
     }
 }
Esempio n. 2
0
 public void ConsumeEvent(IEvent e)
 {
     if (e.GetType() == typeof(EnemyCurrentHealthEvent))
     {
         EnemyCurrentHealthEvent currentHealthEvent = e as EnemyCurrentHealthEvent;
         SetHealth(currentHealthEvent.currentHealth);
         SetDisplayHealth(Mathf.CeilToInt(currentHealthEvent.currentHealth));
     }
     else if (e.GetType() == typeof(EnemyMaxHealthEvent))
     {
         EnemyMaxHealthEvent maxHealthEvent = e as EnemyMaxHealthEvent;
         SetMaxHealth(maxHealthEvent.maxHealth);
     }
 }