Skip to content

Commit

Permalink
feat: Check for client authority in NetworkAnimator Cmd's (#1501)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGadget committed Feb 15, 2020
1 parent 8b359ff commit ecc0659
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Assets/Mirror/Components/NetworkAnimator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ public void ResetTrigger(int hash)
[Command]
void CmdOnAnimationServerMessage(int stateHash, float normalizedTime, int layerId, byte[] parameters)
{
// Ignore messages from client if not in client authority mode
if (!clientAuthority) return;

if (LogFilter.Debug) Debug.Log("OnAnimationMessage for netId=" + netId);

// handle and broadcast
Expand All @@ -463,6 +466,9 @@ void CmdOnAnimationServerMessage(int stateHash, float normalizedTime, int layerI
[Command]
void CmdOnAnimationParametersServerMessage(byte[] parameters)
{
// Ignore messages from client if not in client authority mode
if (!clientAuthority) return;

// handle and broadcast
using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(parameters))
{
Expand All @@ -474,6 +480,9 @@ void CmdOnAnimationParametersServerMessage(byte[] parameters)
[Command]
void CmdOnAnimationTriggerServerMessage(int hash)
{
// Ignore messages from client if not in client authority mode
if (!clientAuthority) return;

// handle and broadcast
HandleAnimTriggerMsg(hash);
RpcOnAnimationTriggerClientMessage(hash);
Expand All @@ -482,6 +491,9 @@ void CmdOnAnimationTriggerServerMessage(int hash)
[Command]
void CmdOnAnimationResetTriggerServerMessage(int hash)
{
// Ignore messages from client if not in client authority mode
if (!clientAuthority) return;

// handle and broadcast
HandleAnimResetTriggerMsg(hash);
RpcOnAnimationResetTriggerClientMessage(hash);
Expand Down

0 comments on commit ecc0659

Please sign in to comment.