예제 #1
0
    void OnTriggerExit2D(Collider2D other)
    {
        if (other.name == "Basket")
        {
            Vector3 hitPosition = other.transform.position;

            if (other.gameObject.transform.root.gameObject.name == "Player 1" || other.gameObject.transform.root.gameObject.name == "Player 1(Clone)")
            {
                Vector3 p1Position  = new Vector3(-7, 1, 0);
                Vector3 dedPosition = (p1Position + hitPosition) * 0.5f;

                dedIconP1.transform.position = dedPosition;
                dedIconP1.SetActive(true);
            }

            if (other.gameObject.transform.root.gameObject.name == "Player 2" || other.gameObject.transform.root.gameObject.name == "Player 2(Clone)")
            {
                Vector3 p2Position  = new Vector3(7, 1, 0);
                Vector3 dedPosition = (p2Position + hitPosition) * 0.5f;

                dedIconP2.transform.position = dedPosition;
                dedIconP2.SetActive(true);
            }

            Destroy(other.gameObject.transform.root.gameObject);
            gameController.GotPoint(other.gameObject.transform.root.gameObject);
        }
    }