diff --git a/logic/THUnity2D/GameObject.cs b/logic/THUnity2D/GameObject.cs index 9cc97bb..4b5026e 100644 --- a/logic/THUnity2D/GameObject.cs +++ b/logic/THUnity2D/GameObject.cs @@ -364,8 +364,8 @@ public virtual void Move(double angle, double distance) return; lastMoveTime = DateTime.Now; MoveStart?.Invoke(this); - XYPosition previousPosition = _position; - _position = _position + new XYPosition(distance * Math.Cos(angle), distance * Math.Sin(angle)); + XYPosition previousPosition = new XYPosition(Math.Round(_position.x, 6), Math.Round(_position.y, 6)); + _position = previousPosition + new XYPosition(distance * Math.Cos(angle), distance * Math.Sin(angle)); Debug(this, "Move from " + previousPosition.ToString() + " angle : " + angle + " distance : " + distance + " aim : " + _position.ToString()); OnMove?.Invoke(this, angle, distance, previousPosition); Debug(this, "Move result poition : " + this._position.ToString()); diff --git a/logic/THUnity2D/Map.cs b/logic/THUnity2D/Map.cs index 28ca0c0..ab71c1d 100644 --- a/logic/THUnity2D/Map.cs +++ b/logic/THUnity2D/Map.cs @@ -473,7 +473,7 @@ void CheckBlockAndAdjustPosition(int x, int y) //调整位置 Debug(this, "Moving " + childrenGameObject.ID + " resultDistance : " + resultDistance); - childrenGameObject._position = previousPosition + new XYPosition(resultDistance * Math.Cos(angle), resultDistance * Math.Sin(angle)); + childrenGameObject._position = previousPosition + new XYPosition(Math.Round(resultDistance * Math.Cos(angle), 6), Math.Round(resultDistance * Math.Sin(angle), 6)); this._grid[(int)previousPosition.x, (int)previousPosition.y].DeleteGameObject(childrenGameObject); this._grid[(int)childrenGameObject.Position.x, (int)childrenGameObject.Position.y].AddGameObject(childrenGameObject); //调整位置 End diff --git a/runAgent.bat b/runAgent.bat index b270836..7399865 100644 --- a/runAgent.bat +++ b/runAgent.bat @@ -1 +1 @@ -communication\Agent\bin\Release\netcoreapp3.0\Communication.Agent.exe --server 127.0.0.1:20000 --port 30000 --debugLevel 0 --playercount 1 --timelimit 25 +communication\Agent\bin\Release\netcoreapp3.0\Communication.Agent.exe --server 127.0.0.1:20000 --port 30000 --debugLevel 0 --playercount 2 --timelimit 25 diff --git a/runServer.bat b/runServer.bat index bf6a48c..13340cb 100644 --- a/runServer.bat +++ b/runServer.bat @@ -1 +1 @@ -logic\Logic.Server\bin\Release\netcoreapp3.0\Logic.Server.exe --port 20000 --debugLevel 1 --playerCount 1 --agentCount 1 --gameTime 600 +logic\Logic.Server\bin\Release\netcoreapp3.0\Logic.Server.exe --port 20000 --debugLevel 1 --playerCount 2 --agentCount 1 --gameTime 600