Skip to content

Commit 12d489c

Browse files
committed
fix: 🐛 CanMove
1 parent 9e79fab commit 12d489c

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# .vs, .vscode must be ignored
22
.vs/
33
.vscode/
4+
.idea/

logic/GameClass/GameObj/Ship.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ public bool Commandable()
385385
public Ship(int initRadius, ShipType shipType, MoneyPool moneyPool) :
386386
base(GameData.PosNotInGame, initRadius, GameObjType.Ship)
387387
{
388-
this.CanMove.SetReturnOri(true);
388+
this.CanMove.SetReturnOri(false);
389389
this.Occupation = OccupationFactory.FindIOccupation(this.ShipType = shipType);
390390
this.ViewRange = this.Occupation.ViewRange;
391391
this.HP = new(this.Occupation.MaxHp);

logic/Gaming/Game.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ public long AddPlayer(PlayerInitInfo playerInitInfo)
3939
}
4040
public bool ActivateShip(long teamID, ShipType shipType, int birthPointIndex = 0)
4141
{
42-
Ship? ship;
43-
ship = teamList[(int)teamID].GetNewShip(shipType);
42+
Ship? ship = teamList[(int)teamID].GetNewShip(shipType);
4443
if (ship == null)
4544
return false;
4645
if (birthPointIndex < 0)
@@ -63,7 +62,6 @@ public bool StartGame(int milliSeconds)
6362
{
6463
if (!gameMap.Timer.StartGame(milliSeconds))
6564
return;
66-
6765
EndGame(); // 游戏结束时要做的事
6866
}
6967
)

logic/Gaming/ShipManager.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,19 @@ private class ShipManager(Map gameMap)
1818
newShip.ShipID.SetReturnOri(shipID);
1919
return newShip;
2020
}
21-
2221
public bool ActivateShip(Ship ship, XY pos)
2322
{
24-
if (ship == null || ship.ShipState != ShipStateType.Deceased)
23+
if (ship.ShipState != ShipStateType.Deceased)
2524
{
2625
return false;
2726
}
2827
ship.Position.x = pos.x;
2928
ship.Position.y = pos.y;
3029
long stateNum = ship.SetShipState(RunningStateType.RunningActively, ShipStateType.Null);
3130
ship.ResetShipState(stateNum);
31+
ship.CanMove.SetReturnOri(true);
3232
return true;
3333
}
34-
3534
public void BeAttacked(Ship ship, Bullet bullet)
3635
{
3736
if (bullet!.Parent!.TeamID == ship.TeamID)

0 commit comments

Comments
 (0)