blob: 21e1551bdf4fcd93137ded21be5d354b541a2a9f (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
using System;
using UnityEngine;
public class ReactorMinigame : Minigame
{
private Color bad = new Color(1f, 0.16078432f, 0f);
private Color good = new Color(0.3019608f, 0.8862745f, 0.8352941f);
private ReactorSystemType reactor;
public TextRenderer statusText;
public SpriteRenderer hand;
private FloatRange YSweep = new FloatRange(-2.15f, 1.56f);
public SpriteRenderer sweeper;
public AudioClip HandSound;
private bool isButtonDown;
public override void Begin(PlayerTask task)
{
ShipStatus instance = ShipStatus.Instance;
if (!instance)
{
this.reactor = new ReactorSystemType();
}
else
{
this.reactor = (instance.Systems[SystemTypes.Reactor] as ReactorSystemType);
}
this.hand.color = this.bad;
}
public void ButtonDown()
{
if (PlayerControl.LocalPlayer.Data.IsImpostor)
{
return;
}
if (!this.reactor.IsActive)
{
return;
}
this.isButtonDown = !this.isButtonDown;
if (this.isButtonDown)
{
if (Constants.ShouldPlaySfx())
{
SoundManager.Instance.PlaySound(this.HandSound, true, 1f);
}
ShipStatus.Instance.RpcRepairSystem(SystemTypes.Reactor, (int)((byte)(64 | base.ConsoleId)));
}
else
{
SoundManager.Instance.StopSound(this.HandSound);
ShipStatus.Instance.RpcRepairSystem(SystemTypes.Reactor, (int)((byte)(32 | base.ConsoleId)));
}
try
{
((SabotageTask)this.MyTask).MarkContributed();
}
catch
{
}
}
public void FixedUpdate()
{
if (!this.reactor.IsActive)
{
if (this.amClosing == Minigame.CloseState.None)
{
this.hand.color = this.good;
this.statusText.Text = "Reactor Nominal";
this.sweeper.enabled = false;
SoundManager.Instance.StopSound(this.HandSound);
base.StartCoroutine(base.CoStartClose(0.75f));
return;
}
}
else
{
if (!this.isButtonDown)
{
this.statusText.Text = "Hold to stop meltdown";
this.sweeper.enabled = false;
return;
}
this.statusText.Text = "Waiting for second user";
Vector3 localPosition = this.sweeper.transform.localPosition;
localPosition.y = this.YSweep.Lerp(Mathf.Sin(Time.time) * 0.5f + 0.5f);
this.sweeper.transform.localPosition = localPosition;
this.sweeper.enabled = true;
}
}
public override void Close()
{
SoundManager.Instance.StopSound(this.HandSound);
if (ShipStatus.Instance)
{
ShipStatus.Instance.RpcRepairSystem(SystemTypes.Reactor, (int)((byte)(32 | base.ConsoleId)));
}
base.Close();
}
}
|