void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.Score())
        {
            scoreAudio.Play();
        }

        if (collider.AnyDeath())
        {
            dieAudio.Play();
        }
    }
Exemple #2
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.AnyDeath())
        {
            GameManager.Instance.PlayerDied();
        }

        if (collider.DieAndLooseEye() && !eyeLost)
        {
            StartCoroutine(Co_SpawnEye());
            eyeLost = true;
        }
    }
    void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.AnyDeath())
        {
            potatoAnimator.SetBool(PotatoState.IsAliveId, false);

            if (isPotatoAlive)
            {
                if (collider.DieAndLooseEye())
                {
                    GetComponent <RotationController>().RotationDirection =
                        RotationController.ERotationDirection.Vertical;

                    potatoAnimator.SetInteger(PotatoState.DeathTypeId, DeathType.LooseEye);
                }
                else if (collider.DieAndSlide())
                {
                    potatoAnimator.SetInteger(PotatoState.DeathTypeId, DeathType.Bowell);
                }
            }

            isPotatoAlive = false;
        }
    }