Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class thermoPowerControlPanel : MonoBehaviour
- {
- public bool t1 = true;
- public int temperature;
- private int tempUp = 10;
- private int tempDown = 1;
- public thermoPowerControlPanel()
- {
- temperature = 100;
- }
- public void turbine1State(bool t1)
- {
- if (t1 == false)
- {
- // ThermoElectric.t1Bool = t1;
- Debug.Log(t1);
- StopCoroutine("increaseTemperature");
- StopCoroutine("decreaseTemperature");
- StartCoroutine("decreaseTemperature");
- }
- if (t1 == true)
- {
- // ThermoElectric.t1Bool = t1;
- Debug.Log(t1);
- StopCoroutine("increaseTemperature");
- StopCoroutine("decreaseTemperature");
- StartCoroutine("increaseTemperature");
- }
- }
- public IEnumerator decreaseTemperature()
- {
- for (int i = 0; i < temperature; i++)
- {
- yield return new WaitForSeconds(1.0f);
- temperature = temperature - tempDown;
- Debug.Log(temperature);
- }
- }
- public IEnumerator increaseTemperature()
- {
- for (int i = 0; i < 100 - temperature; i++)
- {
- yield return new WaitForSeconds(1.0f);
- temperature = temperature + tempUp;
- Debug.Log(temperature);
- }
- }
- }
Add Comment
Please, Sign In to add comment