예제 #1
0
    bool CanGrab(GameObject go, Collider2D col)
    {
        if (go.tag == "MultiBlock")
        {
            multiBlock = go.GetComponentInChildren <MultiBlock>();
            grabDir    = col.name;
            multiBlock.Activate(col.name);
            return(true);
        }

        if (go.tag == "Block" || go.tag == "Slippery" && dude.IsAttachedOrGrabbed())
        {
            Block block = go.GetComponent <Block>();
            if (!dude.HasActivated(block))
            {
                dude.ActivateBlock(block);
                block.Activate();
            }
            return(true);
        }

        if (go.tag == "Limb" && go.transform.parent != transform.parent)
        {
            var d = go.GetComponentInParent <Dude>();
            if (d && d.isAlive)
            {
                d.GetGrabbed();
            }

            return(true);
        }

        return(false);
    }