Beispiel #1
0
    // Die by collision
    // Collider is on child objects
    void OnTriggerEnter2D(Collider2D other)
    {
        string tag = other.gameObject.tag;

        switch (tag)
        {
        case ("Item"):
            score.UpScore();
            soundControls.PlayIntemCatch();
            Destroy(other.gameObject);
            break;

        case ("Bomb"):
            soundControls.PlayBombExplosion();
            Destroy(other.gameObject);
            Die();
            break;
        }
    }