-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEngine.cs
More file actions
72 lines (59 loc) · 2.16 KB
/
Engine.cs
File metadata and controls
72 lines (59 loc) · 2.16 KB
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
using MarsSDK.Environment;
using MarsSDK.Systems;
using MarsSDK.Players;
public class HullBreachEvent : CoOpMissionBase
{
// Define the hardware nodes in the module
public ControlPanel stationA;
public ControlPanel stationB;
public HullSection damagedSector;
private bool isSyncing = false;
private float syncWindow = 1.5f; // Seconds allowed between button presses
void OnBreachDetected(float pressureDropRate)
{
// Alert the squad via the HUD
MissionControl.Broadcast("WARNING: Hull integrity compromised in Sector 4! Manual override required.");
// Trigger red lighting and sirens
EnvironmentManager.SetLighting(damagedSector, LightColor.Red, PulseMode.Rapid);
AudioSystem.PlayGlobal3D("Siren_Breach_Internal", damagedSector.Position);
// Lockdown the sector
damagedSector.Airlocks.SetLocked(true);
}
[PlayerInteraction]
public void OnPanelActivated(Player player, ControlPanel panel)
{
panel.SetStatus(PanelStatus.WaitingForPartner);
if (!isSyncing)
{
StartCoroutine(StartSyncTimer(player));
}
else
{
CompleteSeal(player);
}
}
IEnumerator StartSyncTimer(Player p1)
{
isSyncing = true;
p1.HUD.ShowWarning("WAITING FOR PARTNER SYNC...");
yield return new WaitForSeconds(syncWindow);
if (isSyncing) // If still true, the second player failed to hit it in time
{
isSyncing = false;
p1.HUD.ShowError("SYNC FAILED: TIMED OUT");
EnvironmentManager.ApplyForce(p1, Vector3.Toward(damagedSector.BreachPoint), 50f);
}
}
void CompleteSeal(Player p2)
{
isSyncing = false;
StopAllCoroutines();
// Mechanical Success
damagedSector.SealBreach();
LifeSupport.RestorePressure(damagedSector);
// Rewards and Feedback
MissionControl.Broadcast("Sector 4 stabilized. Nice teamwork, Pioneers.");
ExperienceManager.AwardTeamXP(500);
EnvironmentManager.SetLighting(damagedSector, LightColor.White, PulseMode.None);
}
}