Пример #1
0
    public static PlayerMoveMessage SendToAll(GameObject subjectPlayer, PlayerState state)
    {
        var msg = new PlayerMoveMessage
        {
            SubjectPlayer = subjectPlayer != null?subjectPlayer.GetComponent <NetworkIdentity>().netId : NetworkInstanceId.Invalid,
            State         = state,
        };

        msg.SendToAll();
        return(msg);
    }
Пример #2
0
 public void NotifyPlayers(bool noLerp = false)
 {
     //Generally not sending mid-flight updates (unless there's a sudden change of course etc.)
     if (!serverState.ImportantFlightUpdate && consideredFloatingServer)
     {
         return;
     }
     serverState.NoLerp = noLerp;
     PlayerMoveMessage.SendToAll(gameObject, serverState);
     //Clearing state flags
     serverTargetState.ImportantFlightUpdate = false;
     serverTargetState.ResetClientQueue      = false;
     serverState.ImportantFlightUpdate       = false;
     serverState.ImportantFlightUpdate       = false;
 }
Пример #3
0
    public void NotifyPlayers(bool noLerp)
    {
        //Generally not sending mid-flight updates (unless there's a sudden change of course etc.)
        if (!serverState.ImportantFlightUpdate && consideredFloatingServer)
        {
            return;
        }
        serverState.NoLerp = noLerp;
        var msg = PlayerMoveMessage.SendToAll(gameObject, serverState);

//		Logger.LogTraceFormat("SentToAll {0}", Category.Movement, msg);
        //Clearing state flags
        serverState.ImportantFlightUpdate = false;
        serverState.ResetClientQueue      = false;
    }
Пример #4
0
        private void NotifyPlayers()
        {
            //Do not cache the position if the player is a ghost
            //or else new players will sync the deadbody with the last pos
            //of the ghost:
            if (!playerMove.isGhost)
            {
                serverStateCache = serverState;
            }
            //Generally not sending mid-flight updates (unless there's a sudden change of course etc.)
            if (!serverState.ImportantFlightUpdate && isFloatingServer)
            {
                return;
            }

            PlayerMoveMessage.SendToAll(gameObject, serverState);
            ClearStateFlags();
        }
Пример #5
0
 public static void SendToAll(GameObject subjectPlayer, PlayerState state)
 {
     if (PlayerUtils.IsGhost(subjectPlayer))
     {
         //Send ghost positions only to ghosts
         foreach (var connectedPlayer in PlayerList.Instance.InGamePlayers)
         {
             if (PlayerUtils.IsGhost(connectedPlayer.GameObject))
             {
                 Send(connectedPlayer.GameObject, subjectPlayer, state);
             }
         }
     }
     else
     {
         var msg = new PlayerMoveMessage
         {
             SubjectPlayer = subjectPlayer != null?subjectPlayer.GetComponent <NetworkIdentity>().netId : NetworkInstanceId.Invalid,
             State         = state,
         };
         msg.SendToAll();
     }
 }
Пример #6
0
    public void NotifyPlayers(bool noLerp)
    {
        //Generally not sending mid-flight updates (unless there's a sudden change of course etc.)
        if (!serverState.ImportantFlightUpdate && consideredFloatingServer)
        {
            return;
        }

        //hack to make clients accept non-pull-breaking external pushes for stuff they're pulling
        //because they ignore updates for stuff they pull w/prediction
        bool isPullNudge = pushPull &&
                           pushPull.IsBeingPulled &&
                           !serverState.IsFollowUpdate &&
                           serverState.Impulse != Vector2.zero;

        if (isPullNudge)
        {
            //temporarily "break" pull so that puller would get the update
            InformPullMessage.Send(pushPull.PulledBy, this.pushPull, null);
        }

        serverState.NoLerp = noLerp;
        var msg = PlayerMoveMessage.SendToAll(gameObject, serverState);

//		Logger.LogTraceFormat("SentToAll {0}", Category.Movement, msg);
        //Clearing state flags
        serverState.ImportantFlightUpdate = false;
        serverState.ResetClientQueue      = false;

        if (isPullNudge)
        {
            //restore pull for client.
            //previous fake break erases all pull train info from train head, so we make head aware again
            pushPull.InformHead(pushPull.PulledBy);
//			InformPullMessage.Send( pushPull.PulledBy, this.pushPull, pushPull.PulledBy );
        }
    }