Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (Health <= 0.0f)
     {
         Game.InstantiateRubble(transform.position);
         Game.InstantiateHealthPickup(transform.position);
         Sounds.PlayDestroySFX();
         Destroy(gameObject);
     }
 }
Esempio n. 2
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            Debug.Log("Bang");
            var force = collision.impulse.magnitude;
            player.takeDamage(force);
            Sounds.PlayEnemySFX();

            if (force > MinImpulse)
            {
                Game.InstantiateRubble(transform.position);
                Game.InstantiateHealthPickup(transform.position);
                Sounds.PlayDestroySFX();
                Destroy(gameObject);
            }
        }
    }