private void GrabPushable(Collider other) { Debug.Log("Grabbing pushable from player " + playerMove.PlayerID + " islocal? " + isLocalPlayer + " isServer?" + isServer); if (isLocalPlayer) { ResettableObject ro = other.GetComponent <ResettableObject>(); if (!ro.hasOriginalPosition) { positionOfResettableObject = other.transform.position; rotationOfResettableObject = other.transform.rotation; } else { positionOfResettableObject = ro.OriginalPosition; rotationOfResettableObject = ro.OriginalRotation; } } // Avoid any physics while in the process of grabbing other.GetComponent <Collider>().isTrigger = true; Vector3 touchedPoint = other.gameObject.GetComponent <Collider>().ClosestPointOnBounds(transform.position); if (touchedPoint.y > transform.position.y) { return; } playerMove.transform.LookAt(touchedPoint); fakeObjects[(int)PickupableObject.PickupableType.BigBox].transform.position = other.transform.position; fakeObjects[(int)PickupableObject.PickupableType.BigBox].transform.rotation = other.transform.rotation; // also modify client side if (!isServer) { CmdChangeFakePushableBoxOrientation(fakeObjects[(int)PickupableObject.PickupableType.BigBox].transform.localPosition, fakeObjects[(int)PickupableObject.PickupableType.BigBox].transform.localRotation); } else { RpcChangeFakePushableBoxOrientation(fakeObjects[(int)PickupableObject.PickupableType.BigBox].transform.localPosition, fakeObjects[(int)PickupableObject.PickupableType.BigBox].transform.localRotation); } playerMove.IsGrabingPushable = true; playerMove.rotateSpeed = 0; // Only destroy objects on the server if (isServer) { NetworkServer.Destroy(other.gameObject); } else { CmdServerDestroy(other.gameObject); } timeOfPickup = Time.time; newHeldObj = HoldableType.Pushable; ShowFakeObject(PickupableObject.PickupableType.BigBox); }
public IsHoldableCondition(HoldableType type) { _type = type; }