public new void Update() { base.Update(); //if (heart < 100) heart++; else heart = 0; //if (soul < 100) soul += 2; else soul = 0; //Console.WriteLine(heart); statHeart.SetValue((int)StaticPlayer.Heart); statSoul.SetValue((int)StaticPlayer.Soul); cityStatHealth.SetValue((int)StaticPlayer.CityHealth); cityStatPopPercent.SetValue((int)StaticPlayer.CityPopPercent); cityStatCrimeRate.SetValue((int)StaticPlayer.CityCrimeRate); cityStatUnemployment.SetValue((int)StaticPlayer.CityUnemployment); cityStatHappiness.SetValue((int)StaticPlayer.CityHappiness); if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) { if (CheckCollisionPointRec(new Vector2(GetMouseX(), GetMouseY()), selfCareButton)) { StopSound(Sounds.AMBIENT_CITYHUM); MainClass.stateCity = (StateCity)MainClass.stateManager.State; MainClass.stateManager.SwitchState(new StateSelfCare()); } } }
public void Update() { time++; if (time < 600) { DrawTexture(gameBackgrounds[index], 0, 0, WHITE); DrawTexture(instructionsBackground, 0, 0, WHITE); enoughTapsBar.SetValue(amount); timerBar.SetValue(time); enoughTapsBar.Render(10, 180, RED); timerBar.Render(10, 740, WHITE); int offset = 0; foreach (char c in games[index]) { if (!candidateSelected[index]) { if (GetRandomValue(1, 10) < 9) { DrawText(c.ToString(), 10 + offset, 10, 65, BLACK); } else { candidates[index] = c.ToString(); candidateSelected[index] = true; DrawText(c.ToString(), 10 + offset, 10, 65, GREEN); } } else { if (c.ToString() == candidates[index]) { DrawText(c.ToString(), 10 + offset, 10, 65, GREEN); } else { DrawText(c.ToString(), 10 + offset, 10, 65, BLACK); } } offset += 2 + MeasureText(c.ToString(), 65); } if (candidateSelected[index]) { if (IsKeyReleased(keyMapping[candidates[index]])) { PlaySound(Sounds.HIT); amount += 40; if (amount >= barMax) { StaticPlayer.Heart += heartEffect[index]; StaticPlayer.Soul += soulEffect[index]; if (StaticPlayer.Heart > 100) { StaticPlayer.Heart = 100; } if (StaticPlayer.Soul > 100) { StaticPlayer.Soul = 100; } amount = 0; index++; if (index == gameBackgrounds.Length) { PlaySound(Sounds.TITLE); index = 0; barMax += 100; enoughTapsBar = new UIBar(390, barMax); candidates = new string[games.Length]; candidateSelected = new bool[games.Length]; } } } } amount--; if (amount < 0) { amount = 0; } } else { StopSound(Sounds.MUSIC_SELFCARE); PlaySound(Sounds.AMBIENT_CITYHUM); MainClass.stateManager.SwitchStateNoInit(MainClass.stateCity); } }