Commit f89e3fc7 by alsunj

Remove unnecessary calls

parent 486d51bb
...@@ -17,56 +17,17 @@ public class Door : NetworkBehaviour, IInteractable ...@@ -17,56 +17,17 @@ public class Door : NetworkBehaviour, IInteractable
} }
} }
[ServerRpc(RequireOwnership = false)]
private void CmdOpenDoorForEveryoneServerRpc()
{
RpcOpenDoorForEveryoneClientRpc();
}
[ClientRpc] [ClientRpc]
private void RpcOpenDoorForEveryoneClientRpc() private void DoorOpenClientRpc()
{
Interacted();
}
[ServerRpc(RequireOwnership = false)]
private void CmdCloseDoorForEveryoneServerRpc()
{
RpcCloseDoorForEveryoneClientRpc();
}
[ClientRpc]
private void RpcCloseDoorForEveryoneClientRpc()
{
Interacted();
}
private void DoorOpened()
{
_door.transform.DORotate(
new Vector3(0, 90, 0), 1f)
.SetEase(Ease.OutBounce);
CmdOpenDoorForEveryoneServerRpc();
}
private void DoorOpenedForOtherClients()
{ {
_door.transform.DORotate( _door.transform.DORotate(
new Vector3(0, 90, 0), 1f) new Vector3(0, 90, 0), 1f)
.SetEase(Ease.OutBounce); .SetEase(Ease.OutBounce);
} }
private void DoorClosed()
{
_door.transform.DORotate(
new Vector3(0, 0, 0), 1f)
.SetEase(Ease.OutBounce);
CmdCloseDoorForEveryoneServerRpc();
}
private void DoorClosedForOtherClients() [ClientRpc]
private void DoorCloseClientRpc()
{ {
_door.transform.DORotate( _door.transform.DORotate(
new Vector3(0, 0, 0), 1f) new Vector3(0, 0, 0), 1f)
...@@ -83,25 +44,13 @@ public class Door : NetworkBehaviour, IInteractable ...@@ -83,25 +44,13 @@ public class Door : NetworkBehaviour, IInteractable
{ {
if (!_doorOpened.Value) if (!_doorOpened.Value)
{ {
DoorOpened(); DoorOpenClientRpc();
_doorOpened.Value = true; _doorOpened.Value = true;
} }
else else
{ {
DoorClosed(); DoorCloseClientRpc();
_doorOpened.Value = false; _doorOpened.Value = false;
} }
} }
public void Interacted()
{
if (!_doorOpened.Value)
{
DoorOpenedForOtherClients();
}
else
{
DoorClosedForOtherClients();
}
}
} }
\ No newline at end of file
...@@ -363,7 +363,6 @@ public class PlayerController : NetworkBehaviour ...@@ -363,7 +363,6 @@ public class PlayerController : NetworkBehaviour
case Key key: case Key key:
if (!isRightHandFull) if (!isRightHandFull)
{ {
//Attempt to pick up the key.
key.RequestPickupObject( key.RequestPickupObject(
new NetworkObjectReference(gameObject.GetComponent<NetworkObject>())); new NetworkObjectReference(gameObject.GetComponent<NetworkObject>()));
isRightHandFull = !isRightHandFull; isRightHandFull = !isRightHandFull;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment