Beispiel #1
0
        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;
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 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);
         }
     }
 }
Beispiel #5
0
        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);
        }