コード例 #1
0
    public void ConfirmButtonOnClick()
    {
        if (selectedArchetypeItem == null || selectedAbilityBase == null)
        {
            return;
        }
        if (!GameManager.Instance.PlayerStats.ArchetypeInventory.Contains(selectedArchetypeItem))
        {
            return;
        }

        AbilityCoreItem abilityStorageItem = AbilityCoreItem.CreateAbilityItemFromArchetype(selectedArchetypeItem, selectedAbilityBase);

        if (abilityStorageItem == null)
        {
            return;
        }
        GameManager.Instance.PlayerStats.AddAbilityToInventory(abilityStorageItem);

        SaveManager.CurrentSave.SavePlayerData();
        SaveManager.Save();

        ResetPanel();

        confirmButton.interactable = false;
    }
コード例 #2
0
ファイル: SaveData.cs プロジェクト: v-duong/HeroTowerGame
    public void RemoveAbilityCoreData(AbilityCoreItem abilityCore)
    {
        AbilityCoreSaveData saveData = abilityCoreList.Find(x => x.id == abilityCore.Id);

        if (saveData != null)
        {
            abilityCoreList.Remove(saveData);
        }
    }
コード例 #3
0
 public bool AddAbilityToInventory(AbilityCoreItem newAbility)
 {
     if (abilityStorageInventory.Contains(newAbility))
     {
         return(false);
     }
     abilityStorageInventory.Add(newAbility);
     SaveManager.CurrentSave.SaveAbilityCoreData(newAbility);
     return(true);
 }
コード例 #4
0
ファイル: SaveData.cs プロジェクト: v-duong/HeroTowerGame
 public void SaveAbilityCoreData(AbilityCoreItem abilityCore)
 {
     abilityCoreList.Add(new AbilityCoreSaveData(abilityCore.Id, abilityCore.Base.idName, abilityCore.Name));
 }
コード例 #5
0
 public bool RemoveAbilityFromInventory(AbilityCoreItem newAbility)
 {
     abilityStorageInventory.Remove(newAbility);
     SaveManager.CurrentSave.RemoveAbilityCoreData(newAbility);
     return(true);
 }