public ClientBuilding(byte id, ClientPlayer owner, ClientTile tile) : base(id, owner) { var prefab = Resources.Load("prefabs/buildings/" + id); StackLog.Debug("Instantiating BUILDING"); _gameObject = MainBehaviour.Instantiate(prefab, ((ClientChunk)tile.Chunk).GetGameObject().transform) as GameObject; }
public override Chunk GetTileChunk(int tileX, int tileY) { var chunk = base.GetTileChunk(tileX, tileY); if (chunk == null) { int chunkX = tileX.ToChunkCoordinate(); var chunkY = tileY.ToChunkCoordinate(); chunk = new ClientChunk(this, chunkX, chunkY); this.Add(chunk); StackLog.Debug($"Created {chunk}"); } return(chunk); }
public void SetVisible(bool visible) { if (_gameObj == null) { return; } if (_gameObj.activeSelf == visible) { return; } StackLog.Debug($"Changing activaction of {this} to {visible}"); _gameObj.SetActive(visible); }
public override void SetSeenBy(ExploringEntity entity) { base.SetSeenBy(entity); StackLog.Debug($"{entity} sees {this}"); if (entity.Owner == MainBehaviour.Player) { SetVisible(true); foreach (var party in this.MovingEntities) { ((ClientParty)party).GetGameObject().SetActive(true); } if (this.StaticEntity is IGameObject) { ((IGameObject)this.StaticEntity).GetGameObject().SetActive(true); } } }
public override Tile GetTile(int tileX, int tileY) { if (!ValidCoords(tileX, tileY)) { StackLog.Debug($"Invalid coords {tileX}-{tileY}"); return(null); } var tile = base.GetTile(tileX, tileY); if (tile == null) { StackLog.Debug($"Creating tile {tileX} {tileY}"); var chunk = base.GetTileChunk(tileX, tileY); tile = new ClientTile((ClientChunk)chunk, tileX, tileY); chunk.Tiles[tileX % GameWorld.CHUNK_SIZE, tileY % GameWorld.CHUNK_SIZE] = tile; } return(tile); }