Esempio n. 1
0
    void OnTriggerEnter(Collider other)
    {
        if (snowBallGrow.isDead)
        {
            return;
        }

        if (other.transform.CompareTag("Snowball"))
        {
            iOSHapticFeedback.Instance.Trigger(iOSHapticFeedback.iOSFeedbackType.ImpactLight);

            SnowballGrow otherSnowBalllGrow = other.gameObject.GetComponentInChildren <SnowballGrow>();

            if (otherSnowBalllGrow.isDead)
            {
                return;
            }

            if (snowBallGrow.size > otherSnowBalllGrow.size)
            {
                otherSnowBalllGrow.Die(transform.name);
                snowBallGrow.Grow(5);
                playerInfo.playerKills++;

                if (!playerInfo.isBot)
                {
                    GameManager.Instance.gameUI.GetComponent <GameUI>().CreateScorePopUp(5);
                }
            }
        }

        if (other.transform.CompareTag("Edible"))
        {
            Edible eat = other.gameObject.GetComponent <Edible>();

            //Debug.Log(snowball.localScale);
            if (eat.edibleThreshold <= snowBallGrow.size)
            {
                eat.GetEaten(transform);
            }
        }
    }