コード例 #1
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        snapPosition S = collision.GetComponent <snapPosition>();

        if (S) //checks that the object collided with has a snap position before assuming this needs to be snapped to
        {
            needToSnap = false;
        }
        solutionBox B = collision.GetComponent <solutionBox>();

        if (B)
        {
            B.emptyBox();
        }
    }
コード例 #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        snapPosition S = collision.GetComponent <snapPosition>();

        if (S) //checks that the object collided with has a snap position before assuming this needs to be snapped to
        {
            Vector3 snapPos = S.getSnapPosition().position;
            newPos.x = snapPos.x;
            newPos.y = snapPos.y;

            needToSnap = true;
        }
        solutionBox B = collision.GetComponent <solutionBox>();

        if (B)
        {
            B.check(this.gameObject);
        }
    }