Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag != "Trigger" && other.gameObject.tag != "Player" && other.gameObject.tag != "ShooterBullet")
        {
            switch (other.gameObject.tag)
            {
            case "Shooter":
                Shooter hitShooter = other.GetComponentInParent <Shooter>();
                hitShooter.SubHealth();
                break;

            case "Brawler":
                Brawler hitBrawler = other.GetComponentInParent <Brawler>();
                hitBrawler.SubHealth();
                break;

            case "Ghost":
                Ghost hitGhost = other.GetComponentInParent <Ghost>();
                hitGhost.SubHealth();
                break;

            case "BrawlerGenerator":
                BrawlerGenerator hitBrawlerGenerator = other.GetComponentInParent <BrawlerGenerator>();
                hitBrawlerGenerator.SubHealth();
                break;

            case "GhostGenerator":
                GhostGenerator hitGhostGenerator = other.GetComponentInParent <GhostGenerator>();
                hitGhostGenerator.SubHealth();
                break;

            case "ShooterGenerator":
                ShooterGenerator hitShooterGenerator = other.GetComponentInParent <ShooterGenerator>();
                hitShooterGenerator.SubHealth();
                break;

            default:
                break;
            }

            Destroy(this.gameObject);
            Debug.Log(other.gameObject.name);
        }
    }