void OnTriggerEnter(Collider collider) { if (dying) { return; } IPickup pickup = collider.GetComponent <IPickup>(); if (pickup != null) { pickup.AddPoints(ScoreConstants.EnemyKill); Collider[] colliders = GetComponentsInChildren <Collider>(); for (int i = 0; i < colliders.Length; i++) { colliders[i].enabled = false; } animator.SetTrigger("die"); dyingAudio.Play(); GameObject.Destroy(this.gameObject, 1f); dying = true; } }
void OnCollisionEnter(Collision collision) { IPickup pickup = collision.transform.GetComponent <IPickup>(); if (pickup != null) { pickup.AddPoints(ScoreConstants.HiddenPowerupScore); pickup.AddPowerup(PowerupType.Fireball); Destroy(this.gameObject, 0.01f); } }
void OnCollisionEnter(Collision collision) { IPickup pickup = collision.collider.GetComponent <IPickup>(); if (pickup != null) { pickup.AddPoints(ScoreConstants.PowerupScore); pickup.AddPowerup(PowerupType.ExtraHealth); GameObject.Destroy(this.gameObject, 0.01f); } }