コード例 #1
0
        private void Synchronize()
        {
            if (isLocalPlayer && GameData.IsHeadlessServer)
            {
                return;
            }
            if (isServer)
            {
                CheckTargetUpdate();
            }

            PlayerState state = isLocalPlayer ? predictedState : playerState;

            if (!playerMove.isGhost)
            {
                if (matrix != null)
                {
                    //Client zone
                    CheckMovementClient();
                    //Server zone
                    if (isServer)
                    {
                        CheckMovementServer();
                    }
                }

                if (isLocalPlayer && playerMove.IsPushing || pushPull.pulledBy != null)
                {
                    return;
                }

                //Check if we should still be displaying an ItemListTab and update it, if so.
                ControlTabs.CheckItemListTab();

                if (PullingObject != null)
                {
                    if (transform.hasChanged)
                    {
                        transform.hasChanged = false;
                        PullObject();
                    }
                    else if (PullingObject.transform.localPosition != pullPos)
                    {
                        PullingObject.transform.localPosition = pullPos;
                    }
                }

                //Registering
                if (registerTile.Position != Vector3Int.RoundToInt(state.Position))
                {
                    RegisterObjects();
                }
            }
            else
            {
                if (!GhostPositionReady)
                {
                    GhostLerp(state);
                }
            }
        }
コード例 #2
0
        private bool IsPointlessMove(PlayerState state, PlayerAction action)
        {
            bool change;

            return(state.WorldPosition.Equals(NextState(state, action, out change).WorldPosition));
        }