-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ships can move now (probably)
- Loading branch information
Showing
13 changed files
with
172 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[InternetShortcut] | ||
URL=https://thuai7.panxuc.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System; | ||
using System.Threading; | ||
using GameClass.GameObj; | ||
using GameEngine; | ||
using Preparation.Utility; | ||
using Protobuf; | ||
using Timothy.FrameRateTask; | ||
|
||
namespace Gaming | ||
{ | ||
public partial class Game | ||
{ | ||
private readonly ActionManager actionManager; | ||
private class ActionManager | ||
{ | ||
public readonly MoveEngine moveEngine; | ||
public bool MoveShip(Ship shipToMove, int moveTimeInMilliseconds, double moveDirection) | ||
{ | ||
if (moveTimeInMilliseconds < 5) | ||
{ | ||
return false; | ||
} | ||
long stateNum = shipToMove.SetShipState(RunningStateType.Waiting, ShipStateType.Moving); | ||
if (stateNum == -1) | ||
{ | ||
return false; | ||
} | ||
new Thread | ||
( | ||
() => | ||
{ | ||
shipToMove.ThreadNum.WaitOne(); | ||
if (!shipToMove.StartThread(stateNum, RunningStateType.RunningActively)) | ||
{ | ||
shipToMove.ThreadNum.Release(); | ||
return; | ||
} | ||
moveEngine.MoveObj(shipToMove, moveTimeInMilliseconds, moveDirection, shipToMove.StateNum); | ||
Thread.Sleep(moveTimeInMilliseconds); | ||
shipToMove.ResetShipState(stateNum); | ||
} | ||
) | ||
{ IsBackground = true }.Start(); | ||
return true; | ||
} | ||
public static bool Stop(Ship ship) | ||
{ | ||
lock (ship.ActionLock) | ||
{ | ||
if(ship.Commandable()) | ||
{ | ||
ship.SetShipState(RunningStateType.Null); | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters