-
Notifications
You must be signed in to change notification settings - Fork 1
/
Upgrade.cs
48 lines (43 loc) · 1.21 KB
/
Upgrade.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
40
41
42
43
44
45
46
47
48
using HarmonyLib;
using System.Collections;
using System;
using UnityEngine;
namespace MiniRealisticAirways
{
[HarmonyPatch(typeof(UpgradeManager), "Start", new Type[] { })]
class PatchUpgradeManagerStart
{
static bool Prefix(ref float ___upgradeInterval)
{
// Double the speed for upgrade.
___upgradeInterval /= 2;
return true;
}
static public IEnumerator AddApronAfterStart()
{
yield return new WaitForSeconds(0.5f);
for (int i = 0; i < 3; i++)
{
TakeoffTaskManager.Instance.AddApron();
}
}
static void Postfix(ref int[] ___counter)
{
if (___counter.Length == 0)
{
return;
}
if (MapManager.gameMode == GameMode.SandBox)
{
return;
}
// Starts with 3 apron upgrade.
for (int i = 0; i < 3; i++)
{
___counter[(int)UpgradeOpt.LONGER_TAXIWAY]++;
}
// Delay this action to avoid nullptr.
TakeoffTaskManager.Instance.StartCoroutine(AddApronAfterStart());
}
}
}