Power - spotřebovává se když jsou zavřené dveře. Hráči mohou zavírat pouze dveře na svojí polovině mapy. Oprava bugu v MovementOpportunity, který způsoboval zpožďování intervalu.
This commit is contained in:
parent
7656707177
commit
25a62af483
22 changed files with 240 additions and 59 deletions
|
|
@ -5,8 +5,8 @@ namespace PacketLib;
|
|||
|
||||
#nullable disable
|
||||
public struct GameEvent : INetSerializable{
|
||||
public static GameEvent PLAYER_JOIN(int pid) => new(){ID = 0, Args = [pid] }; // TODO: username sync
|
||||
public static GameEvent PLAYER_LEAVE(int pid) => new(){ID = 1, Args = [pid] }; // TODO: id constants
|
||||
public static GameEvent PLAYER_JOIN(int pid) => new(){ID = 0, Args = [pid] };
|
||||
public static GameEvent PLAYER_LEAVE(int pid) => new(){ID = 1, Args = [pid] };
|
||||
public static GameEvent SWITCH_CAM(int pid, int id) => new(){ID = 2, Args = [pid, id] };
|
||||
public static GameEvent TOGGLE_MONITOR(int pid, bool state) => new(){ID = 3, Args = [pid, state ? 1 : 0]};
|
||||
public static GameEvent TOGGLE_DOOR_OFFICE(int pid, int doorId, bool state) => new(){ID = 4, Args = [pid, doorId, state ? 1 : 0]};
|
||||
|
|
@ -21,6 +21,8 @@ public struct GameEvent : INetSerializable{
|
|||
|
||||
public static GameEvent PLAYER_WIN(int pid) => new(){ID = 11, Args = [pid]};
|
||||
public static GameEvent GAME_START() => new(){ID = 12};
|
||||
public static GameEvent POWER_TICK(int pid, int power) => new(){ID = 13, Args = [pid, power]};
|
||||
public static GameEvent POWER_OUT(int pid) => new(){ID = 14, Args = [pid]};
|
||||
|
||||
public int ID{ get; set; }
|
||||
public bool Hideable => ID < 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
namespace PacketLib;
|
||||
|
||||
public class MapInitPacket {
|
||||
public int[] Connectors { get; set; } // triplets (tile1 id, tile2 id, type)
|
||||
public int[] Connectors { get; set; } // quadruplets (tile1 id, tile2 id, type, owner)
|
||||
public int[] YourTiles { get; set; }
|
||||
public int[] OpponentTiles { get; set; }
|
||||
public bool UpsideDown { get; set; }
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ using LiteNetLib.Utils;
|
|||
|
||||
namespace PacketLib;
|
||||
|
||||
public struct PlayerState : INetSerializable { // TODO: separate mutable and immutable data
|
||||
public struct PlayerState : INetSerializable { // TODO: make a constructor
|
||||
public int pid;
|
||||
public int camera;
|
||||
public bool monitorUp;
|
||||
|
|
@ -12,6 +12,9 @@ public struct PlayerState : INetSerializable { // TODO: separate mutable and imm
|
|||
public bool[] doorStates;
|
||||
public int[] neighbouringTiles; // the indexes should correspond in both arrays
|
||||
|
||||
public int power;
|
||||
public bool poweredOut;
|
||||
|
||||
public void Serialize(NetDataWriter writer) {
|
||||
writer.Put(pid);
|
||||
writer.Put(camera);
|
||||
|
|
@ -19,6 +22,8 @@ public struct PlayerState : INetSerializable { // TODO: separate mutable and imm
|
|||
writer.PutArray(doorStates);
|
||||
writer.Put(officeTileId);
|
||||
writer.PutArray(neighbouringTiles);
|
||||
writer.Put(power);
|
||||
writer.Put(poweredOut);
|
||||
}
|
||||
|
||||
public void Deserialize(NetDataReader reader) {
|
||||
|
|
@ -28,6 +33,8 @@ public struct PlayerState : INetSerializable { // TODO: separate mutable and imm
|
|||
doorStates = reader.GetBoolArray();
|
||||
officeTileId = reader.GetInt();
|
||||
neighbouringTiles = reader.GetIntArray();
|
||||
power = reader.GetInt();
|
||||
poweredOut = reader.GetBool();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue