using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Temperature : MonoBehaviour { public float minTemperature = 32; public float temperature = 32; public float maxTemperature = 105; public float temperatureFactor = 30; public bool overheating; void Update() { float tempChange = Time.deltaTime * temperatureFactor; if (Input.GetKey(KeyCode.LeftShift) && !overheating) { temperature = Math.Min(maxTemperature, temperature + tempChange); if (temperature == maxTemperature) { overheating = true; } } else if (!Input.GetKey(KeyCode.W)) { temperature = Math.Max(minTemperature, temperature - tempChange); if (temperature == minTemperature) { overheating = false; } } } }
using System;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)