Inheritance: UnityEngine.Networking.MessageBase
Beispiel #1
0
 public void SetTrigger(int hash)
 {
     AnimationTriggerMessage msg = new AnimationTriggerMessage {
         netId = base.netId,
         hash = hash
     };
     if (base.hasAuthority && base.localPlayerAuthority)
     {
         if (NetworkClient.allClients.Count > 0)
         {
             NetworkConnection readyConnection = ClientScene.readyConnection;
             if (readyConnection != null)
             {
                 readyConnection.Send(0x2a, msg);
             }
         }
     }
     else if (base.isServer && !base.localPlayerAuthority)
     {
         NetworkServer.SendToReady(base.gameObject, 0x2a, msg);
     }
 }
 /// <summary>
 ///   <para>Causes an animation trigger to be invoked for a networked object.</para>
 /// </summary>
 /// <param name="name">Name of trigger.</param>
 /// <param name="hash">Hash id of trigger (from the Animator).</param>
 /// <param name="triggerName"></param>
 public void SetTrigger(int hash)
 {
   AnimationTriggerMessage animationTriggerMessage = new AnimationTriggerMessage();
   animationTriggerMessage.netId = this.netId;
   animationTriggerMessage.hash = hash;
   if (this.hasAuthority && this.localPlayerAuthority)
   {
     if (NetworkClient.allClients.Count <= 0)
       return;
     NetworkConnection readyConnection = ClientScene.readyConnection;
     if (readyConnection == null)
       return;
     readyConnection.Send((short) 42, (MessageBase) animationTriggerMessage);
   }
   else
   {
     if (!this.isServer || this.localPlayerAuthority)
       return;
     NetworkServer.SendToReady(this.gameObject, (short) 42, (MessageBase) animationTriggerMessage);
   }
 }