void OnPlayerMove(byte[] data, Action5001 action) { ReqPlayerMove req = ProtoBufUtils.Deserialize <ReqPlayerMove>(data); Player player = FindPlayer(req.gid); if (player == null) { return; } NotifyPlayerMove msg = new NotifyPlayerMove(); msg.uid = req.gid; msg.moveData = req; for (int i = 0; i < player.mScene.GetPlayerCount(); ++i) { Player p = player.mScene.GetPlayerByIndex(i); if (p == player) { p.Speed = req.speed; p.Direction = req.direction.ToVector3(); p.Position = req.position.ToVector3(); p.IsControl = req.control; continue; } NetWork.NotifyMessage <NotifyPlayerMove>(p.UserID, STC.STC_PlayerMove, msg); } }
static void OnPlayerMove(byte[] data) { Scene scn = SceneSystem.Instance.mCurrentScene; if (scn == null) { return; } NotifyPlayerMove moveInfo = ProtoBufUtils.Deserialize <NotifyPlayerMove>(data); Player player = scn.GetPlayer(moveInfo.uid); if (player == null) { return; } player.SyncMove.AddMoveData(moveInfo.moveData); }