Skip to content

Instantly share code, notes, and snippets.

@SenpaiRar
Last active May 13, 2019 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SenpaiRar/ccadf8bd9a10ecca2c607e0e49126c3b to your computer and use it in GitHub Desktop.
Save SenpaiRar/ccadf8bd9a10ecca2c607e0e49126c3b to your computer and use it in GitHub Desktop.
This DaycountManager takes care of changing the DifficultyLevel variable.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DayCountManager : MonoBehaviour
{
//This is the current day. We set it at 1 at the start
[HideInInspector]
public int CurrentDay;
//We make a Populator_Manager reference so we can drag the Populator_Manager and use its difficulty function
public Populator_Manager Populator;
void Start(){
CurrentDay = 1;
}
void Update(){
Debug.Log("Day:"+CurrentDay);
}
public void NextDay(){
//The previous script, SleepClickable, calls the NextDay() function to move to the next day
//When it does this, it checks if it's between a certain set of numbers, and then we change the
//Difficulty Level accordingly
if(CurrentDay > 1 && CurrentDay <= 3){
Populator.ChangeDifficultyLevel(2);
}
if(CurrentDay > 3 && CurrentDay <= 10){
Populator.ChangeDifficultyLevel(3);
}
//We then call the Populator to reset the Dynamic Objects in the world
//Reseting the zombies and the crates in the world
Populator.ResetDynamicObjects();
//We then add 1 to the current day
CurrentDay += 1; //Add a day to the counter
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment