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); } }); } }
public void OnDamageReceived(ProjectileProperties projectileProp, int newHP) { if (newHP < 1) { Explode(); } else { flash.FlashSlugStyle(); } }
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); } }
public void OnDamageReceived(ProjectileProperties projectileProp, int newHP) { if (newHP > 1) { flashRed.FlashSlugStyle(); EventManager.TriggerEvent(GlobalEvents.PointsEarned, 100); audioManager.PlaySound(0); } else { Die(); } }
public override void OnHit(ProjectileProperties proj) { flashRed.FlashSlugStyle(); }