Esempio n. 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag.Equals(Tags.Enemy))
        {
            TakeDamage();
        }

        if (other.tag.Equals(Tags.GreenJewel))
        {
            levelTransition.FirstLevelIsPassed();
            PlayerCollectedGreenJewel(other);
        }

        if (other.tag.Equals(Tags.PinkJewel))
        {
            levelTransition.SecondLevelIsPassed();
            PlayerCollectedPinkJewel(other);
        }

        if (other.tag.Equals(Tags.YellowJewel))
        {
            levelTransition.ThirdLevelIsPassed();
            PlayerCollectedYellowJewel(other);
        }
    }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D otherObject)
    {
        if (otherObject.tag.Equals(Tags.Coin))
        {
            collectiblesManager.IncreaseCoinsCounter();
            PlayerCollectedCoin(otherObject);
        }

        else if (otherObject.tag.Equals(Tags.SlimeBlue) || otherObject.tag.Equals(Tags.SlimeGreen) ||
                 otherObject.tag.Equals(Tags.SlimePurple) || otherObject.tag.Equals(Tags.Spike))
        {
            lifeManager.TakeOneLife();
            collectiblesManager.ResetCoinsCount();
            PlayerDied(player);
        }

        else if (otherObject.tag.Equals(Tags.JewelBlue))
        {
            collectiblesManager.IncreaseBlueJewelCounter();
            levelTransition.FirstLevelIsPassed();
            PlayerCollectedBlueJewel(otherObject);
        }

        else if (otherObject.tag.Equals(Tags.JewelGreen))
        {
            collectiblesManager.IncreaseGreenJewelCounter();
            levelTransition.SecondLevelIsPassed();
            PlayerCollectedGreenJewel(otherObject);
        }

        else if (otherObject.tag.Equals(Tags.JewelRed))
        {
            collectiblesManager.IncreaseRedJewelCounter();
            PlayerCollectedRedJewel(otherObject);
        }
    }