Beispiel #1
0
 void DoState(GUnit unit, SyncStateInfo syncInfo)
 {
     if (syncInfo.stateType == ObjectStateType.Start)
     {
         ObjectStateProcess.Start(unit, syncInfo.stateId, syncInfo.stateParam, false);
     }
     else if (syncInfo.stateType == ObjectStateType.Update)
     {
         ObjectStateProcess.Update(unit, syncInfo.stateId, syncInfo.stateParam, false);
     }
     else if (syncInfo.stateType == ObjectStateType.Finish)
     {
         ObjectStateProcess.Finish(unit, syncInfo.stateId, false);
     }
 }
Beispiel #2
0
    public override void HandleMessage(MessageInfo message)
    {
        if (MessageManager.isNetwork)
        {
            // ステート同期メッセージ
            if (message.messageType == MessageType.SyncState)
            {
                SyncStateInfo info = new SyncStateInfo();
                message.GetExtraInfo <SyncStateInfo>(ref info);

                currentStateNames[message.fromPlayerID] = info.cStateName.ToString();
                return;
            }
        }

        stateMachine.HandleMessage(message);
    }
Beispiel #3
0
        static void SyncObjectState()
        {
            var offsetKeyFrame       = 5;
            var preparedSyncInfoList = _syncData.preparedSyncInfoList;

            foreach (var serverSyncInfo in preparedSyncInfoList)
            {
                var syncStateInfo = new SyncStateInfo()
                {
                    stateId    = serverSyncInfo.stateId,
                    stateParam = serverSyncInfo.stateParam,
                    stateType  = serverSyncInfo.stateType
                };

                var totalOffset = _syncData.internalFrame + offsetKeyFrame;
                syncStateInfo.serverKeyFrame = _syncData.currentKeyFrame + totalOffset / _syncData.internalFrameSize;
                syncStateInfo.internalFrame  = totalOffset % _syncData.internalFrameSize;

                var unit = WorldManager.Instance.Unit.GetUnit(serverSyncInfo.unitId);
                ObjectSync.AddState(unit, syncStateInfo);
            }

            preparedSyncInfoList.Clear();
        }
Beispiel #4
0
        public static void AddState(GUnit unit, SyncStateInfo syncInfo)
        {
            var objectSyncData = unit.GetData <ObjectSyncData>();

            objectSyncData.stateSyncInfoList.Add(syncInfo);
        }