コード例 #1
0
    void ColliderCheck(Collider2D other)
    {
        if (state == States.waiting && other.tag == "Grabable")
        {
            // Get the grab component
            GrabParent grabComp = other.GetComponent <GrabParent>();

            // If it aint in the main object then check the parent
            if (grabComp == null)
            {
                grabComp = other.GetComponentInParent <GrabParent>();
            }

            // in any of the cases, target it.
            if (grabComp)
            {
                SetTarget(other.transform, true);

                grabComp.ParentStartGrab();
            }
        }
    }
コード例 #2
0
 void Awake()
 {
     grab  = GetComponent <GrabParent> ();
     anim  = GetComponent <Animator> ();
     rbody = GetComponent <Rigidbody2D> ();
 }