예제 #1
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            collision.GetComponent <MouseMovement>().score++;
            GameManager.Instance.ResetHunger();
            GameManager.Instance.foodSpawned.Remove(this.gameObject);
            player.EatFood();
            Destroy(gameObject);
            print("Howdy");
            Pop.StartChat();
        }

        if (collision.gameObject.CompareTag("Food")) //stops from spawning on another food object
        {
            GameManager.Instance.foodSpawned.Remove(this.gameObject);
            Destroy(gameObject);
        }

        if (collision.gameObject.CompareTag("Wall")) //stops from spawning in wall
        {
            GameManager.Instance.foodSpawned.Remove(this.gameObject);
            Destroy(gameObject);
        }

        if (collision.gameObject.CompareTag("Hiding")) //stops from spawning in hiding spots
        {
            GameManager.Instance.foodSpawned.Remove(this.gameObject);
            Destroy(gameObject);
        }

        if (collision.gameObject.CompareTag("Prop")) //stops from spawning in on props with colliders
        {
            GameManager.Instance.foodSpawned.Remove(this.gameObject);
            Destroy(gameObject);
        }
    }