// Start is called before the first frame update
    void Start()
    {
        lvlUpAnimator = lvlUpObject.GetComponent <Animator>();
        levelText     = levelTextObject.GetComponent <Text>();
        npcMgr        = gameObject.GetComponent <NPCManager>();
        gameMgr       = gameObject.GetComponent <GameManager>();
        playerMgr     = playerObj.GetComponent <PlayerManager>();
        scoreMgr      = scoreObj.GetComponent <ScoreManager>();
        cactiMgr      = gameObject.GetComponent <CactiManager>();
        skillsMgr     = gameObject.GetComponent <SkillsManager>();

        if (false)
        //if (PlayerPrefs.HasKey("currentLvl"))
        {
            currentNpcTypeAWorth  = PlayerPrefs.GetFloat("npcTypeAWorth");
            currentNpcTypeALife   = PlayerPrefs.GetFloat("npcTypeALife");
            currentNpcTypeASpeed  = PlayerPrefs.GetFloat("npcTypeASpeed");
            currentNpcSpawnRate   = PlayerPrefs.GetFloat("npcSpawnRate");
            currentCactiSpawnRate = PlayerPrefs.GetFloat("cactiSpawnRate");
            macroLevelCount       = PlayerPrefs.GetInt("currentLvl");
        }
        else
        {
            currentNpcTypeAWorth  = npcMainBaseValue * npcWorthFactor;
            currentNpcTypeALife   = npcMainBaseValue * npcLifeFactor;
            currentNpcTypeASpeed  = npcMainBaseValue * npcSpeedFactor;
            currentNpcSpawnRate   = npcMainBaseValue * npcSpawnRateFactor;
            currentCactiSpawnRate = npcMainBaseValue * cactiSpawnRateFactor;
            PlayerPrefs.SetFloat("npcTypeAWorth", currentNpcTypeAWorth);
            PlayerPrefs.SetFloat("npcTypeALife", currentNpcTypeALife);
            PlayerPrefs.SetFloat("npcTypeASpeed", currentNpcTypeASpeed);
            PlayerPrefs.SetFloat("npcSpawnRate", currentNpcSpawnRate);
            PlayerPrefs.SetFloat("cactiSpawnRate", currentCactiSpawnRate);
            PlayerPrefs.SetInt("currentLvl", 1);
        }
        levelText.text = "Level: " + macroLevelCount;
    }
Beispiel #2
0
 // Start is called before the first frame update
 private void Start()
 {
     npcMgr   = gameObject.GetComponent <NPCManager>();
     cactiMgr = gameObject.GetComponent <CactiManager>();
 }