Пример #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            IPowerUp IPowerUp = other.GetComponent <IPowerUp>();
            if (IPowerUp != null)
            {
                AudioSource.PlayClipAtPoint(_clip, transform.position);
                switch (powerupID)
                {
                case 0:
                    IPowerUp.TripleLaserBoost();
                    break;

                case 1:
                    IPowerUp.SpeedBoost();
                    break;

                case 2:
                    IPowerUp.ShieldBoost();
                    break;

                default:
                    break;
                }
            }
            Destroy(this.gameObject);
        }
    }