void Start() { player = SaveSEAttributes.LoadPlayer(); nameText.GetComponent <Text>().text = player.PlayerName; ageText.GetComponent <Text>().text = Math.Round(player.PlayerAge) + " years old"; currencyText.GetComponent <Text>().text = "$ " + player.PlayerCurrency; }
public static void IncreaseHunger(SEAttributes player) // SE gets more hungry over time { if (player.Hunger > 0) { player.Hunger -= 1; } SaveSEAttributes.SavePlayer(player); }
public static void IncreaseTired(SEAttributes player) // SE gets more tired over time { if (player.Tired > 0) { player.Tired -= 1; } SaveSEAttributes.SavePlayer(player); }
public static void DecreaseMood(SEAttributes player) // SE gets more sad when working { if (player.Mood > 0) { player.Mood -= 1; } SaveSEAttributes.SavePlayer(player); }
public static void IncreaseMood(SEAttributes player) // SE gets happier when using entertainment { if (player.Mood < 100) { player.Mood += 1; } SaveSEAttributes.SavePlayer(player); }
public static void DecreaseHunger(SEAttributes player) // When SE eats { if (player.Hunger < 100) { player.Hunger += 1; } SaveSEAttributes.SavePlayer(player); }
public static void IncreaseFitness(SEAttributes player) // When SE eats { if (player.Fitness < 100) { player.Fitness += 1; } SaveSEAttributes.SavePlayer(player); }
public static void DecreaseFitness(SEAttributes player) // When SE eats { if (player.Fitness > 0) { player.Fitness -= 1; } SaveSEAttributes.SavePlayer(player); }
public static void DecreaseTired(SEAttributes player) // SE gets less tired { if (player.Tired < 100) { player.Tired += 1; } SaveSEAttributes.SavePlayer(player); }
// 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); } } } }
// private Sprite chair, chair2, chair3, chair4, chair5; // Use this for initialization void Start() { player = SaveSEAttributes.LoadPlayer(); moneyAmount = player.PlayerCurrency; //moneyAmount = PlayerPrefs.GetInt ("MoneyAmount"); GameObject initialState = GameObject.Find("Canvas/Chair"); rend = initialState.GetComponent <Image>(); rend.sprite = ChangeChair.chairs[ChangeChair.upgrade + 1]; }
public static void Rest(SEAttributes player) // SE sleeps and is not tired { if (player.Tired <= 90) { player.Tired += 10; } else if (player.Tired > 90) { player.Tired = 100; } SaveSEAttributes.SavePlayer(player); }
private void OnTriggerExit2D(Collider2D other) { if (other.CompareTag("Player")) { playerInRange = false; buttonBox.SetActive(false); dialogBox.SetActive(false); SEAttributes player = SaveSEAttributes.LoadPlayer(); player.currState = ""; SaveSEAttributes.SavePlayer(player); } }
public void SelectSleep() { SEAttributes player = SaveSEAttributes.LoadPlayer(); player.currState = "sleeping"; SaveSEAttributes.SavePlayer(player); if (dialogBox.activeInHierarchy) { dialogBox.SetActive(false); } else { dialogBox.SetActive(true); } dialog.text = "You are now sleeping.."; }
public void SelectTv() { SEAttributes player = SaveSEAttributes.LoadPlayer(); player.currState = "entertainment"; SaveSEAttributes.SavePlayer(player); if (dialogBox.activeInHierarchy) { dialogBox.SetActive(false); } else { dialogBox.SetActive(true); } dialog.text = "You are now playing Wii.."; }
// Start is called before the first frame update void Start() { animator = GetComponent <Animator>(); rend = GetComponent <SpriteRenderer>(); boy = Resources.Load <Sprite>("boy"); girl = Resources.Load <Sprite>("girl"); SEAttributes player = SaveSEAttributes.LoadPlayer(); if (player.PlayerGender == "male") { rend.sprite = boy; animator.SetBool("isMale", true); } else if (player.PlayerGender == "female") { rend.sprite = girl; animator.SetBool("isMale", false); } }
// Start is called before the first frame update void Start() { player = SaveSEAttributes.LoadPlayer(); TombText.GetComponent <Text>().text = player.PlayerName + " you died at " + Math.Round(player.PlayerAge) + " years old" + "with $ " + player.PlayerCurrency; }
void Start() { SEAttributes player = SaveSEAttributes.LoadPlayer(); username = player.PlayerName; }
public static void AdjustCurrency(SEAttributes player, double deltaCurrency) // When money is earned (+) or spent (-) { player.PlayerCurrency += deltaCurrency; SaveSEAttributes.SavePlayer(player); }
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); }
// Update is called once per frame void Update() { SEAttributes player = SaveSEAttributes.LoadPlayer(); TimeStep.TimeEvent((System.DateTime.Now - player.StartTime).Seconds, player); }
public void SelectSave() { SEAttributes player = SaveSEAttributes.LoadPlayer(); SaveSEAttributes.SavePlayer(player); }