示例#1
0
        private static GlobalTalentContainer BuildNewContainer()
        {
            GlobalTalentContainer output = new GlobalTalentContainer();

            output.UnspentEmbers = 0;

            output.DoubleJumpTalents = new Dictionary <TalentEnum, int>();
            output.JetpackTalents    = new Dictionary <TalentEnum, int>();
            output.DashTalents       = new Dictionary <TalentEnum, int>();

            output.GhastTalents  = new Dictionary <TalentEnum, int>();
            output.CryoTalents   = new Dictionary <TalentEnum, int>();
            output.GoblinTalents = new Dictionary <TalentEnum, int>();

            foreach (TalentEnum talent in Enum.GetValues(typeof(TalentEnum)))
            {
                output.DoubleJumpTalents[talent] = 0;
                output.JetpackTalents[talent]    = 0;
                output.DashTalents[talent]       = 0;
                output.GhastTalents[talent]      = 0;
                output.CryoTalents[talent]       = 0;
                output.GoblinTalents[talent]     = 0;
            }

            return(output);
        }
示例#2
0
        public void OnTalentPurchase()
        {
            TalentInfoContainer.DescriptionContainer description = TalentInfoContainer.infoDictionary[selectedTalent];
            int currentRank = currentTalentRanks[selectedTalent];
            int cost        = (currentRank + 1) * description.BaseCost;

            if (currentRank < description.NumRanks && cost <= GlobalTalentContainer.GetInstance().UnspentEmbers)
            {
                currentTalentRanks[selectedTalent]++;
                GlobalTalentContainer.GetInstance().UnspentEmbers -= cost;
                ReloadTalents();
                HandleTalentDisplayPanel();
            }
        }
示例#3
0
        private static void LoadContainer()
        {
            string dataPath = Path.Combine(Application.persistentDataPath, Constants.TALENT_FILE_NAME);

            if (File.Exists(dataPath))
            {
                using (StreamReader reader = File.OpenText(dataPath)) {
                    string jsonString = reader.ReadToEnd();
                    Instance = JsonConvert.DeserializeObject <GlobalTalentContainer>(jsonString);
                }
            }
            else
            {
                Instance = BuildNewContainer();
            }
        }
示例#4
0
        private void ReloadTalents()
        {
            if (showingExplorers)
            {
                switch (currentExplorer)
                {
                case ExplorerEnum.DOUBLE_JUMP:
                    currentTalentRanks = GlobalTalentContainer.GetInstance().DoubleJumpTalents;
                    break;

                case ExplorerEnum.JETPACK:
                    currentTalentRanks = GlobalTalentContainer.GetInstance().JetpackTalents;
                    break;

                case ExplorerEnum.DASH:
                    currentTalentRanks = GlobalTalentContainer.GetInstance().DashTalents;
                    break;
                }
            }
            else
            {
                switch (currentNightmare)
                {
                case NightmareEnum.GHAST:
                    currentTalentRanks = GlobalTalentContainer.GetInstance().GhastTalents;
                    break;

                case NightmareEnum.CRYO:
                    currentTalentRanks = GlobalTalentContainer.GetInstance().CryoTalents;
                    break;

                case NightmareEnum.GOBLIN:
                    currentTalentRanks = GlobalTalentContainer.GetInstance().GoblinTalents;
                    break;
                }
            }
            explorerPanel.SetActive(showingExplorers);
            nightmarePanel.SetActive(!showingExplorers);
            foreach (TalentEnum talent in Enum.GetValues(typeof(TalentEnum)))
            {
                TalentInfoContainer.DescriptionContainer description = TalentInfoContainer.infoDictionary[talent];
                TalentButton button = sceneButtons[talent];
                button.SetRankLabel(currentTalentRanks[talent], description.NumRanks);
            }
            unspentEmberText.text = "Unspent Embers: " + GlobalTalentContainer.GetInstance().UnspentEmbers;
        }
        public void Awake()
        {
            if (PlayerStateContainer.Instance.IsWinner)
            {
                victoryText.text = "Victory";
            }
            else
            {
                victoryText.text = "Defeat";
            }

            rescueText.text    = "Rescue Embers: " + PlayerStateContainer.Instance.RescueEmbers;
            objectiveText.text = "Objective Embers: " + (int)PlayerStateContainer.Instance.ObjectiveEmbers;
            upgradeText.text   = "Upgrade Embers: " + PlayerStateContainer.Instance.UpgradeEmbers;
            totalText.text     = "Total Embers: " + PlayerStateContainer.Instance.TotalEmbers();

            if (PlayerStateContainer.Instance.TeamSelection == PlayerStateContainer.NIGHTMARE)
            {
                rescueText.enabled = false;
            }

            GlobalTalentContainer.GetInstance().UnspentEmbers += PlayerStateContainer.Instance.TotalEmbers();
            GlobalTalentContainer.SaveInstance();
        }
示例#6
0
 public static void ForceReload()
 {
     Instance = null;
     LoadContainer();
 }
示例#7
0
 public void OnCancelClicked()
 {
     GlobalTalentContainer.ForceReload();
     SceneManager.LoadScene("LauncherScene");
 }
示例#8
0
 public void OnApplyClicked()
 {
     GlobalTalentContainer.SaveInstance();
     SceneManager.LoadScene("LauncherScene");
 }
 protected override void LoadTalents()
 {
     talentRanks = GlobalTalentContainer.GetInstance().CryoTalents;
 }