コード例 #1
0
        public bool Update()
        {
            // TODO:    Take in an "effort" or "work" amount to subtract from
            //          the job's time-to-completion meter. When meter reaches
            //          zero, job is completed so return true.
            Board.Tile tile = game.board.GetTile(position);
            if (tile.HasLargeItem())
            {
                Debug.LogError(
                    "Dropping job, Tile" + position + " already has large item."
                    );
                return(true); // TODO: Replace with some other status check.
            }

            Item.Wall wall = new Item.Wall(game);
            wall.position = position;
            tile.SetLargeItem(wall);

            return(true);
        }
コード例 #2
0
    public void Render()
    {
        if (backgroundSpriteRenderer == null || largeItemSpriteRenderer == null)
        {
            // This can happen if `Render` is called _before_ `Start`, which
            // happens when first constructed. It is a normal thing to happen
            // so we just ignore this state.
            return;
        }

        // TODO: Render a sprite for each item on the tile.

        largeItemSpriteRenderer.sprite = null;
        TileManager tm = TileManager.instance;

        // No tile? Render an edge!
        if (tile == null)
        {
            SetType(Board.TileType.Edge);
            return;
        }

        // If we have a large item, fetch its sprite.
        if (tile.HasLargeItem())
        {
            Debug.Log("Tile" + gridPosition + " has a large item!");
            Sprite sprite = null;
            if (tm.itemSprites.TryGetValue(tile.GetLargeItem().type, out sprite))
            {
                largeItemSpriteRenderer.sprite = sprite;
            }
            else
            {
                Debug.LogError("Could not find sprite for " + tile.GetLargeItem().type);
            }
        }

        SetType(tile.type);
    }