// Update is called once per frame void Update() { updateView(); hourCount -= Time.deltaTime; if (Mathf.Round(hourCount) == 0) { hourCount = 3600; projects.hourPass(); List <Project> projectList = projects.GetProjects(); foreach (Project item in projectList) { if (item.Deadline == 0) { int id = item.ID; projects.RemoveProjects(id); Project newProject = generateNewProject(id); projects.AddProject(newProject); } } } if (workingOn != 0) { minuteCount[workingOn - 1] -= Time.deltaTime; if (ChangeComputer.upgrade) { minuteCount[workingOn - 1] -= Time.deltaTime; UnityEngine.Debug.Log("computer change"); } //print(minuteCount[workingOn - 1]); if (Mathf.Round(minuteCount[workingOn - 1]) == 0) { minuteCount[workingOn - 1] = 1; int minuteLeft = projects.minutePass(workingOn); //print(minuteLeft); if (minuteLeft == 0) { Project compProject = projects.GetProject(workingOn); compProject.Completion = true; int awardCurrency = compProject.Currency; int awardExp = compProject.Exp; SEAttributes player = SaveSEAttributes.LoadPlayer(); SEAttributesController.AdjustCurrency(player, awardCurrency); projects.RemoveProjects(workingOn); Project newProject = generateNewProject(workingOn); projects.AddProject(newProject); int temp = workingOn; stopProject(); setSceneActive(temp); setPreviousSceneInactive(temp); } } } }
public void exitShop() { // PlayerPrefs.SetInt ("MoneyAmount", moneyAmount); SEAttributesController.AdjustCurrency(player, -player.PlayerCurrency); SEAttributesController.AdjustCurrency(player, moneyAmount); for (int i = 0; i < amount; i++) { SEAttributesController.DecreaseHunger(player); } SceneManager.LoadScene("GeneralRoom"); }
public static void TimeEvent(int gameMinutes, SEAttributes player) { if (gameMinutes % 7 == 0 && gameMinutes != prevtime) // In ~ 12 hours (1 day), their hunger, tiredness and fitness will be at 0 { for (int i = 0; i >= 0; i -= 15) { SEAttributesController.IncreaseTired(player); SEAttributesController.DecreaseFitness(player); } SEAttributesController.IncreaseHunger(player); SEAttributesController.DecreaseMood(player); if (alt) { if (AddItem.isTree) { SEAttributesController.IncreaseMood(player); SEAttributesController.DecreaseHunger(player); } if (AddItem.isPlant) { SEAttributesController.IncreaseMood(player); } } alt = !alt; } if (player.currState != "" && gameMinutes % 4 == 0 && gameMinutes != prevtime) { if (player.currState == "entertainment") { SEAttributesController.IncreaseMood(player); if (gameMinutes % 2 == 0 && ChangeTv.upgrade) { SEAttributesController.IncreaseMood(player); } } else if (player.currState == "working") { SEAttributesController.DecreaseMood(player); if (gameMinutes % 2 == 0) { SEAttributesController.IncreaseTired(player); if (gameMinutes % (6 - ChangeChair.upgrade) == 0) { SEAttributesController.DecreaseTired(player); } } } else if (player.currState == "exercising") { SEAttributesController.IncreaseFitness(player); UnityEngine.Debug.Log("happening"); if (AddItem.isTread && gameMinutes % 2 == 0) { SEAttributesController.IncreaseFitness(player); } } else if (player.currState == "sleeping") { SEAttributesController.Rest(player); SEAttributesController.IncreaseMood(player); } } //UnityEngine.Debug.Log(gameMinutes); if (gameMinutes % 25 == 0 && gameMinutes != prevtime) { //factor = ((double)player.Mood + player.Hunger + player.Tired + player.Fitness)/400; player.PlayerAge = player.PlayerAge + 1; SaveSEAttributes.SavePlayer(player); //UnityEngine.Debug.Log("worked" + player.PlayerAge); //UnityEngine.Debug.Log(factor); } prevtime = gameMinutes; CheckDeath(player); }