Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Food" && gameObject.tag == "Snake_Head")
        {
            if (!playerBehaviour)
            {
                playerBehaviour = FindObjectOfType <PlayerBehaviour>();
            }

            playerBehaviour.AddTail();

            ScoreManager.Instance.UpdateValues(other.gameObject.GetComponent <PickUpObject>().CollectableItem);
            other.gameObject.GetComponent <PoolObjects>().DisablePoolObject();
            SpawnManager.Instance.SpawnCollectable();
        }
        else
        if (other.gameObject.tag == "Wall" || other.gameObject.tag == "Snake_Tail")
        {
            GameManager.Instance.UpdateState(Enums.StateGame.GameOver);
            GameManager.Instance.EnableGameOverPopup();
        }
    }