Ejemplo n.º 1
0
    void RpcGrabLocalObject(NetworkInstanceId netId)
    {
        //GameObject localObj = NetworkServer.FindLocalObject(netId);
        GameObject localObj = ClientScene.FindLocalObject(netId);

        if (localObj == null)
        {
            return;
        }

        IGrabable grab = localObj.GetComponent <IGrabable>();

        if (grab == null)
        {
            return;
        }

        _grabbedObject = grab;
        _grabbedObject.OnGrab(this);
    }
Ejemplo n.º 2
0
    void CmdAttemptGrab()
    {
        // TODO: Check and grab
        Transform grabTransform = _grabArea.GetClosestGrabable();

        if (grabTransform == null)
        {
            return;
        }

        IGrabable grab = grabTransform.GetComponent <IGrabable>();

        if (grab == null)
        {
            return;
        }

        _grabbedObject = grab;
        _grabbedObject.OnGrab(this);

        RpcGrabLocalObject(grab.GetNetId());
    }