-
Notifications
You must be signed in to change notification settings - Fork 71
/
TurboCharger.cs
39 lines (32 loc) · 956 Bytes
/
TurboCharger.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using UnityEngine;
using System.Collections;
namespace Chapter.Facade
{
public class TurboCharger : MonoBehaviour
{
public BikeEngine engine;
private bool _isTurboOn;
private CoolingSystem _coolingSystem;
public void ToggleTurbo(CoolingSystem coolingSystem)
{
_coolingSystem = coolingSystem;
if (!_isTurboOn)
StartCoroutine(TurboCharge());
}
IEnumerator TurboCharge()
{
_isTurboOn = true;
_coolingSystem.PauseCooling();
yield return new WaitForSeconds(engine.turboDuration);
_isTurboOn = false;
_coolingSystem.PauseCooling();
}
void OnGUI()
{
GUI.color = Color.green;
GUI.Label(
new Rect(100, 60, 500, 20),
"Turbo Activated: " + _isTurboOn);
}
}
}