Ejemplo n.º 1
0
    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;
        }
    }
Ejemplo n.º 2
0
    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);
        }
    }
Ejemplo n.º 3
0
    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);
        }
    }