Example #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            Destroy(gameObject);
            other.gameObject.GetComponent <PlayerController>().IncreaseCoinCount();

            if (other.gameObject.GetComponent <PlayerController>().IsLevelComplete())
            {
                DoorController.DeleteDoor();
            }
        }
    }