private void _on_RemoveEquipTypeButton_pressed()
    {
        int selected = GetNode <ItemList>("EquipLabel/EquipContainer/EquipContainer/EquipList").GetSelectedItems()[0];

        equipIdArray.RemoveAt(selected);
        GetNode <ItemList>("EquipLabel/EquipContainer/EquipContainer/EquipList").RemoveItem(selected);
    }
Example #2
0
    public CardData GetRandomCard()
    {
        var selectedIndex = (int)(_random.Randi() % _cards.Count);
        var cardDataJson  = (Godot.Collections.Dictionary)_cards[selectedIndex];

        var cardType = cardDataJson["type"].ToString();

        var cardData = new CardData
        {
            Id          = cardDataJson["id"].ToString(),
            Name        = cardDataJson["name"].ToString(),
            Description = cardDataJson["description"].ToString(),
            Type        = cardDataJson["type"].ToString(),
            Image       = cardDataJson["image"].ToString(),
        };

        if (cardType == nameof(CardType.Weapon))
        {
            cardData = new WeaponCardData
            {
                Id          = cardDataJson["id"].ToString(),
                Name        = cardDataJson["name"].ToString(),
                Description = cardDataJson["description"].ToString(),
                Type        = cardDataJson["type"].ToString(),
                Image       = cardDataJson["image"].ToString(),
                Range       = int.Parse(cardDataJson["range"].ToString()),
                Wide        = int.Parse(cardDataJson["wide"].ToString()),
            };
        }

        _graveyard.Add(cardDataJson);
        _cards.RemoveAt(selectedIndex);

        return(cardData);
    }
Example #3
0
 public void _OnPieceScreenExited()
 {
     // @FIXME Probably not the best solution
     InstancedScenes[0].QueueFree();
     InstancedScenes.RemoveAt(0);
     GD.Print("Piece isn't visible anymore. Destroy it.");
 }
Example #4
0
    private void _on_RemoveButton_pressed()
    {
        int selected = GetNode <ItemList>("SkillLabel/SkillContainer/HBoxContainer/SkillListContainer/SkillList").GetSelectedItems()[0];

        GetNode <ItemList>("SkillLabel/SkillContainer/HBoxContainer/SkillListContainer/SkillList").RemoveItem(selected);
        GetNode <ItemList>("SkillLabel/SkillContainer/HBoxContainer/SkillLevelContainer/SkillLevelList").RemoveItem(selected);
        skillListArray.RemoveAt(selected);
    }
Example #5
0
    public static List <System.Object> ArrayToList(Godot.Collections.Array array)
    {
        List <System.Object> ret = new List <System.Object>();

        while (array.Count > 0)
        {
            ret.Add(array[0]);
            array.RemoveAt(0);
        }
        return(ret);
    }
Example #6
0
 void checkArray()
 {
     for (int i = 0; i < enemiesInRange.Count; i++)
     {
         GD.Print(enemiesInRange[i].Name);
         if (enemiesInRange[i].dead)
         {
             GD.Print("Achei alguem pra deletar");
             enemiesInRange[i].onDeath();
             enemiesInRange.RemoveAt(i);
         }
     }
 }
Example #7
0
    private void calculatePath()
    {
        currentSpawnPointIndex = gameworld.getNextSpawnIndex(currentSpawnPointIndex);
        // targetPaths = gameworld.getPaths(GlobalPosition, gameworld.getSpawnPointPosition(currentSpawnPointIndex));

        Godot.Collections.Array excludes = new Godot.Collections.Array()
        {
            this
        };

        targetPaths = gameworld.getPaths(GlobalPosition, gameworld.getSpawnPointPosition(currentSpawnPointIndex + 1), GetWorld2d(), excludes);

        if (targetPaths != null && targetPaths.Count < 1)
        {
            targetPaths = null;
        }

        if (targetPaths != null)
        {
            targetPaths.RemoveAt(0);
        }
    }
Example #8
0
    private void _processMessage()
    {
        if (_popUpMessageTimer.IsStopped() && _messages.Count > 0)
        {
            QueueMessage message = _messages[0];

            _messageName.BbcodeText     = message.Title;
            _messageBody.BbcodeText     = message.Body;
            _popUpMessageTimer.WaitTime = message.Time;

            _messages.RemoveAt(0);

            this.Show();
            _popUpMessageTimer.Start();
        }
    }
Example #9
0
    void DelPlayer(int id)
    {
        int pos = Players.IndexOf(id);

        if (pos != -1)
        {
            Players.RemoveAt(pos);
            List.RemoveItem(pos);
            if (Turn > pos)
            {
                Turn -= 1;
            }
            if (GetTree().IsNetworkServer())
            {
                Rpc("SetTurn", Turn);
            }
        }
    }