Přidán build script, předělaná struktura, funkční spouštění serveru z clienta. Client je schopen fungovat po více her bez restartu. Bugfixy
This commit is contained in:
parent
c942d23a87
commit
1a27dd6fab
22 changed files with 269 additions and 136 deletions
|
|
@ -11,7 +11,7 @@ public class GameLogic {
|
|||
public const int START_CAMERA = 12;
|
||||
|
||||
private static MovementOpportunity secondCycleTimer = new(1000);
|
||||
private static MovementOpportunity gamePhaseTimer = new(30_000);
|
||||
private static MovementOpportunity gamePhaseTimer = new(60_000);
|
||||
public static bool NSecondUpdate{ get; private set; } = false;
|
||||
|
||||
public static MapTile P1Office;
|
||||
|
|
@ -84,7 +84,7 @@ public class GameLogic {
|
|||
// EnemyManager.AddEnemy(new MareEnemy(10)).Spawn(MapManager.Get(22));
|
||||
|
||||
EnemyManager.AddEnemy(new LurkEnemy(4)).Spawn(MapManager.Get(2));
|
||||
EnemyManager.AddEnemy(new NekoEnemy(4)).Spawn(MapManager.Get(22));
|
||||
EnemyManager.AddEnemy(new NekoEnemy(4)).Spawn(MapManager.Get(0));
|
||||
|
||||
}
|
||||
public static void Update() {
|
||||
|
|
@ -122,9 +122,16 @@ public class GameLogic {
|
|||
}
|
||||
|
||||
public static void DeclareWinner(ServerPlayer player) {
|
||||
Server.SendUpdateToAll([GameEvent.PLAYER_WIN(player.state.pid)]);
|
||||
if (Server.Players.Count == 2){
|
||||
Server.SendUpdateToAll([GameEvent.PLAYER_WIN(player.state.pid)]);
|
||||
Console.WriteLine("Player " + player.state.pid + " won!");
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
Server.Stop();
|
||||
Console.WriteLine("Player " + player.state.pid + " won!");
|
||||
|
||||
if (!Server.AutoStop){
|
||||
Program.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
private static (int p1Usage, int p2Usage) CalculatePowerUsage() {
|
||||
|
|
@ -158,7 +165,7 @@ public class GameLogic {
|
|||
PhaseCounter++;
|
||||
Server.SendUpdateToAll([GameEvent.NEXT_PHASE()]);
|
||||
|
||||
int roll = random.Next(3);
|
||||
int roll = spawnOrder.Count > 0 ? random.Next(3) : random.Next(1,3);
|
||||
switch (roll){
|
||||
case 0:
|
||||
int spawnRoll = random.Next(spawnOrder[0].Count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue