コード例 #1
0
ファイル: Worker.cs プロジェクト: NatalieWolfe/BaseBuilder
    private void UpdateCollection(float deltaTime)
    {
        // TODO: Pull inventory component from container.
        Item.Chest chest = targetContainer as Item.Chest;
        foreach (string itemType in GetMissingItemTypes())
        {
            SmallItem item = chest.inventory.GetItemByType(itemType);
            if (item != null)
            {
                // TODO: Remove the item from the target container too.
                // chest.inventory.RemoveItemOfType(itemType);

                // TODO: Figure out better way of handling items than by reference.
                inventory.AddItem(new ItemReference(item));
            }
        }

        // We're done with this container.
        targetContainer = null;
    }
コード例 #2
0
    void Start()
    {
        if (instance != null && instance != this)
        {
            Destroy(this);
            return;
        }
        instance = this;

        // TODO: Make board generation dynamic.
        game = new Game(50, 50);

        // TODO: Load the item database from configurations.
        game.itemDB.SetLargeItemProto("Chest", new Item.Chest(game));

        // TODO: Make layout of board dynamic.
        // FIXME: Remove all this crap, just for debugging.
        Item.Chest chest = game.itemDB.CreateLargeItem("Chest") as Item.Chest;
        game.board.GetTile(0, 1).SetLargeItem(chest);

        SmallItem item = game.itemDB.CreateSmallItem("Wood");

        chest.inventory.AddItem(new ItemReference(item));
    }
コード例 #3
0
ファイル: Chest.cs プロジェクト: NatalieWolfe/BaseBuilder
 private Chest(Chest other) : base(other as LargeItem)
 {
     this.inventory = new Inventory(other.inventory.capacity);
 }