Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        //Pause timer if the player is in battle
        if (CharacterInstance.Instance.GetInBattle())
        {
            return;
        }

        RefreshRate    -= Time.deltaTime;
        difficultyspawn = basedifficulty + GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterInventory>().getTotalResource();

        if (RefreshRate <= 0f)
        {
            foreach (Waypoints p in paths)
            {
                if (p.GetPatrols() <= smallest && p.GetPatrols() <= p.GetMaxPatrols())
                {
                    smallest = p.GetPatrols();
                    selected = p;
                }
            }

            if (selected.GetPatrols() < selected.GetMaxPatrols())
            {
                selected.GetClosetsSpawn().SpawnNormal(selected);
            }

            RefreshRate = 10.0f;
            smallest    = 10;
        }
    }