Ejemplo n.º 1
0
    // Called when the inventory enters the scene tree for the first time.
    public override void _Ready()
    {
        cellGuiScene = GD.Load <PackedScene>("res://scenes/CellGui.tscn");

        for (int i = 0; i < this.NumCells; i++)
        {
            CellGui cell = (CellGui)cellGuiScene.Instance();
            this.AddChild(cell);
            cell.SetPosition(new Vector2(64 * i, 0));
            cell.Connect("CellClicked", this, "OnCellClicked");
            this.cells.Add(cell);
        }

        this.SetSize(new Vector2(64 * NumCells, 64));
    }
Ejemplo n.º 2
0
 private void OnCellClicked(CellGui cellClicked)
 {
     Player.EquipGun(cellClicked.gun);
 }
Ejemplo n.º 3
0
 void OnCellClicked(CellGui cell)
 {
     // Emit Inventory's signal.
     this.EmitSignal("CellClicked", cell);
 }