Ejemplo n.º 1
0
 public void OnDamageReceived(ProjectileProperties projectileProp, int newHP)
 {
     if (newHP > 0)
     {
         flashRed.FlashSlugStyle();
         audioManager.PlaySound(0);
         EventManager.TriggerEvent(GlobalEvents.PointsEarned, 100);
         return;
     }
     else if (!dead)
     {
         dead           = true;
         gameObject.tag = "World";
         animator.SetTrigger("explode");
         CancelInvoke();
         audioManager.PlaySound(3);
         float  startTime           = Time.time;
         float  duration            = 0.7f;
         Bounds boundsForExplosions = collider.bounds;
         timeUtils.RepeatEvery(0.045f, () => {
             // Visual
             Animator anim           = SimpleAnimatorPool.GetPooledAnimator(explosion);
             anim.transform.position = RandomPosWithin(boundsForExplosions);
             anim.Play("1");
             if (Time.time > startTime + duration)
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         });
     }
 }
Ejemplo n.º 2
0
 public void OnDamageReceived(ProjectileProperties projectileProp, int newHP)
 {
     if (newHP < 1)
     {
         Explode();
     }
     else
     {
         flash.FlashSlugStyle();
     }
 }
Ejemplo n.º 3
0
 public void OnDamageReceived(ProjectileProperties projectileProp, int newHP)
 {
     if (newHP > 0)
     {
         flashRed.FlashSlugStyle();
         return;
     }
     else if (!dead)
     {
         dead = true;
         flashRed.FlashSlugStyle();
         hideEnemy.enabled = false;
         animator.SetTrigger("destroyed");
         explosions.SetActive(true);
         debris.SetActive(true);
         colliderWhenDestroyed.enabled = true;
         gameObject.tag = "World";
         collectible.gameObject.SetActive(true);
         colliderRamp.enabled = false;
         enemySpawner.gameObject.SetActive(false);
     }
 }
Ejemplo n.º 4
0
 public void OnDamageReceived(ProjectileProperties projectileProp, int newHP)
 {
     if (newHP > 1)
     {
         flashRed.FlashSlugStyle();
         EventManager.TriggerEvent(GlobalEvents.PointsEarned, 100);
         audioManager.PlaySound(0);
     }
     else
     {
         Die();
     }
 }
Ejemplo n.º 5
0
 public override void OnHit(ProjectileProperties proj)
 {
     flashRed.FlashSlugStyle();
 }