示例#1
0
    public void Hold(Holdable key)
    {
        this.keyBeingHeld  = key;
        key.rb.isKinematic = true;
        key.OnHeldBy(this);

        foreach (var c in key.GetComponentsInChildren <Collider>())
        {
            Physics.IgnoreCollision(cc, c);
        }
    }
示例#2
0
    public Holdable Drop()
    {
        if (keyBeingHeld)
        {
            keyBeingHeld.OnDropped();
            keyBeingHeld.rb.isKinematic = false;

            foreach (var c in keyBeingHeld.GetComponentsInChildren <Collider>())
            {
                Physics.IgnoreCollision(cc, c, false);
            }

            var key = keyBeingHeld;
            keyBeingHeld = null;
            return(key);
        }
        return(null);
    }