// Start is called before the first frame update private void Start() { dataSavingManager = GameObject.FindGameObjectWithTag("DataSavingManager").GetComponent<DataSavingManager>(); uiManager = GameObject.FindGameObjectWithTag("UIManager").GetComponent<UIManager>(); blockSpawner = GameObject.FindGameObjectWithTag("BlockSpawner").GetComponent<BlockSpawner>(); offlineProgress = new UnityAction<object>(HandleOfflineProgress); EventManager.StartListening("OfflineProgress", offlineProgress); blockKilled = new UnityAction<object>(BlockKilled); EventManager.StartListening("BlockKilled", blockKilled); prestige = new UnityAction<object>(Prestige); EventManager.StartListening("Prestige", prestige); tryUpgrade = new UnityAction<object>(UpgradeSkill); EventManager.StartListening("TryUpgrade", tryUpgrade); UpdatePlayerMoneyAndUI((double)dataSavingManager.GetOtherValue("Money")); UpdatePlayerPrestigeMoneyAndUI((double)dataSavingManager.GetOtherValue("PrestigeMoney")); UpdatePendingPrestigeMoneyAndUI((double)dataSavingManager.GetOtherValue("PendingPrestigeMoney")); playerMoneyMult = (double)dataSavingManager.GetOtherValue("MoneyMultiplier"); // Load skill dictionary into shop and ui uiManager.LoadSkillDescriptions(dataSavingManager.GetSkillDictionary()); uiManager.SetSkillPanelsVisibility(dataSavingManager.GetSkillDictionary()); uiManager.SetDamagePanelsVisibilty(dataSavingManager.GetSkillDictionary()); LoadHelpers(); }
private void LoadHelpers() { // Gets only skills that are helpers and unlocked. var helpers = dataSavingManager.GetSkillDictionary().Where(s => s.Value.type == SkillType.HELPER && s.Value.level >= 2).ToList(); foreach (var s in helpers) { Vector2 randPos = new Vector2(UnityEngine.Random.Range(-2f, 2f), UnityEngine.Random.Range(-4f, 4f)); var helper = Instantiate(helperPrefab, randPos, Quaternion.identity); helper.gameObject.GetComponent<Helper>().Init(s.Value.name); } }