Ejemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        PlatformerController2D controller = other.gameObject.GetComponent <PlatformerController2D>();

        if (controller != null)
        {
            controller.CollectCoin();
            Destroy(gameObject);
        }
    }
Ejemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        PlatformerController2D controller = other.gameObject.GetComponent <PlatformerController2D>();

        if (controller != null)
        {
            controller.CollectCoin();
            Doorway door = FindObjectOfType <Doorway>();
            if (door != null)
            {
                door.CoinCollected();
            }
            Destroy(gameObject);
        }
    }