První 3 monstra z plánovaných pěti. Kompletní pathfinding i zrcadlení do clienta. Útoky implementované nejsou. Lurk a Neko jsou hardcoded aby útočili na P1.
This commit is contained in:
parent
4484b127c5
commit
9bfe63a166
27 changed files with 772 additions and 47 deletions
|
|
@ -6,16 +6,18 @@ 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] };
|
||||
public static GameEvent PLAYER_LEAVE(int pid) => new(){ID = 1, Args = [pid] }; // TODO: id constants
|
||||
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]};
|
||||
public static GameEvent TOGGLE_DOOR_REMOTE(int pid, (int, int) doorId, bool state) => new(){ID = 5, Args = [pid, doorId.Item1, doorId.Item2, state ? 1 : 0]};
|
||||
|
||||
public static GameEvent ENEMY_SPAWN(int enemyTypeId, int enemyId, int difficulty, int camId) => new(){ ID = 6, Args = [enemyTypeId, enemyId, difficulty, camId] };
|
||||
public static GameEvent ENEMY_MOVEMENT(int enemyId, int camId) => new(){ID = 7, Args = [enemyId, camId]};
|
||||
public static GameEvent ENEMY_ATTACK(int enemyId, int pid) => new(){ ID = 8, Args =[enemyId, pid] };
|
||||
public static GameEvent ENEMY_RESET(int enemyId, int camId) => new(){ID = 9, Args = [enemyId, camId]};
|
||||
|
||||
|
||||
|
||||
|
||||
public static GameEvent ENEMY_MOVEMENT(int enemyId, int camId) => new(){ID = -1, Args = [enemyId, camId]};
|
||||
public static GameEvent SPOT_SET_ACTIVE(int enemyId, bool state) => new(){ ID = 10, Args = [enemyId, state ? 1 : 0] };
|
||||
|
||||
public int ID{ get; set; }
|
||||
public bool Hideable => ID < 0;
|
||||
|
|
|
|||
|
|
@ -3,19 +3,22 @@ using LiteNetLib.Utils;
|
|||
|
||||
namespace PacketLib;
|
||||
|
||||
public struct PlayerState : INetSerializable {
|
||||
public struct PlayerState : INetSerializable { // TODO: separate mutable and immutable data
|
||||
public int pid;
|
||||
public int camera;
|
||||
public bool monitorUp;
|
||||
|
||||
public int officeTileId;
|
||||
public bool[] doorStates;
|
||||
|
||||
public int[] neighbouringTiles; // the indexes should correspond in both arrays
|
||||
|
||||
public void Serialize(NetDataWriter writer) {
|
||||
writer.Put(pid);
|
||||
writer.Put(camera);
|
||||
writer.Put(monitorUp);
|
||||
writer.PutArray(doorStates);
|
||||
writer.Put(officeTileId);
|
||||
writer.PutArray(neighbouringTiles);
|
||||
}
|
||||
|
||||
public void Deserialize(NetDataReader reader) {
|
||||
|
|
@ -23,6 +26,8 @@ public struct PlayerState : INetSerializable {
|
|||
camera = reader.GetInt();
|
||||
monitorUp = reader.GetBool();
|
||||
doorStates = reader.GetBoolArray();
|
||||
officeTileId = reader.GetInt();
|
||||
neighbouringTiles = reader.GetIntArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue