PlaceTrove() public method

public PlaceTrove ( int x, int y ) : void
x int
y int
return void
Ejemplo n.º 1
0
        private void HandleUpdateTileItemTasks()
        {
            UpdateTileItemTask[] tasks = _mailbox.GetSubscribedTasksForType <UpdateTileItemTask>(this);

            for (int i = 0; i < tasks.Length; i++)
            {
                UpdateTileItemTask task = tasks[i];
                task.IsFinished = true;
                _mailbox.RemoveTask(task);

                if (task.Exists)
                {
                    _treasureTroveManager.PlaceTrove(task.Position.x, task.Position.y);
                }
                else
                {
                    _treasureTroveManager.RemoveTrove(task.Position.x, task.Position.y);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Helper function for creating the board
        /// </summary>
        private void CreateMap(IO.Models.GameState state)
        {
            var board = state.BoardNames[_sceneConfiguration.BoardName];

            _positionLookUp.Grid   = _grid;
            _positionLookUp.Height = board.Height;
            _positionLookUp.Width  = board.Width;

            for (int x = 0; x < board.Width; x++)
            {
                for (int y = 0; y < board.Height; y++)
                {
                    PTile ptile = board.Grid[x * board.Height + y];

                    if (ptile.Items.Count > 0)
                    {
                        _treasureTrovesManager.PlaceTrove(x, y);
                    }

                    if (ptile.TileType == PTileType.Void)
                    {
                        continue;
                    }

                    if (ptile.GroundSprite != "")
                    {
                        Tile tile = _tileDatabase.GetTile(ptile.GroundSprite);
                        _groundTilemap.SetTile(new Vector3Int(x, (board.Height - 1) - y, 0), tile);
                    }

                    if (ptile.AboveSprite != "")
                    {
                        Tile tile = _tileDatabase.GetTile(ptile.AboveSprite);
                        _aboveTilemap.SetTile(new Vector3Int(x, (board.Height - 1) - y, -1), tile);
                    }
                }
            }
        }