Na začátku hry se mapa na serveru synchronizuje s mapou u clienta. Rozšířen spritesheet monitoru o remote dveře. Přidána GlobalClassLib pro kód sdílený mezi clientem a serverem. Základ pro implementaci ovládání remote dveří.
This commit is contained in:
parent
8801a7c919
commit
7e6b3d724b
25 changed files with 374 additions and 67 deletions
|
|
@ -1,25 +1,44 @@
|
|||
using System.Net.Security;
|
||||
using GlobalClassLib;
|
||||
|
||||
namespace FNAF_Server.Map;
|
||||
|
||||
public class MapTile {
|
||||
public int Id { get; private set; }
|
||||
public ServerPlayer Owner { get; private set; }
|
||||
public bool Lit { get; set; } = false;
|
||||
public class MapTile : GlobalMapTile<TileConnector, MapTile> {
|
||||
public ServerPlayer Owner{ get; private set; }
|
||||
|
||||
private List<TileConnector> Connectors { get; set; } = new();
|
||||
|
||||
public MapTile(int id, ServerPlayer owner) {
|
||||
Id = id;
|
||||
public MapTile(int id, ServerPlayer owner) : base(id) {
|
||||
Owner = owner;
|
||||
}
|
||||
public void AddConnector(MapTile tile, TileConnector.ConnectorType type, int value) {
|
||||
Connectors.Add(new TileConnector(this, tile, type, value));
|
||||
tile.Connectors.Add(new TileConnector(tile, this, type, value));
|
||||
}
|
||||
|
||||
public void AddConnectors((MapTile tile, TileConnector.ConnectorType type, int value)[] connectors) =>
|
||||
Array.ForEach(connectors, c => AddConnector(c.tile, c.type, c.value));
|
||||
|
||||
public override string ToString() => $"{PositionAsString} -> {string.Join(", ", Connectors.Select(c => c.Tiles.Item2.PositionAsString))}";
|
||||
public string PositionAsString => $"[{Id / 5}, {Id % 5}]"; // for debug purposes
|
||||
// public int Id { get; private set; }
|
||||
// public ServerPlayer Owner { get; private set; }
|
||||
// public bool Lit { get; set; } = false;
|
||||
//
|
||||
// private List<TileConnector> connectors = new();
|
||||
//
|
||||
// public MapTile(int id, ServerPlayer owner) {
|
||||
// Id = id;
|
||||
// Owner = owner;
|
||||
// }
|
||||
// public void AddConnector(MapTile tile, TileConnector.ConnectorType type, int value) {
|
||||
// connectors.Add(new TileConnector(this, tile, type, value));
|
||||
// tile.connectors.Add(new TileConnector(tile, this, type, value));
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void AddConnectors((MapTile tile, TileConnector.ConnectorType type, int value)[] connectors) =>
|
||||
// Array.ForEach(connectors, c => AddConnector(c.tile, c.type, c.value));
|
||||
//
|
||||
// public override string ToString() => $"{PositionAsString} -> {string.Join(", ", connectors.Select(c => c.Tiles.Item2.PositionAsString))}";
|
||||
// public string PositionAsString => $"[{Id}]"; // for debug purposes
|
||||
//
|
||||
// public TileConnector? GetConnector(int id) {
|
||||
// foreach (var con in connectors){
|
||||
// if (con.Tiles.Item2.Id == id) return con;
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue