-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpikes.cs
More file actions
131 lines (115 loc) · 5.98 KB
/
Copy pathSpikes.cs
File metadata and controls
131 lines (115 loc) · 5.98 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using HutongGames.PlayMaker.Actions;
using Modding;
using UnityEngine;
using Satchel;
using HutongGames.PlayMaker;
using System.Reflection;
using HutongGames.PlayMaker.Ecosystem.Utils;
using InControl;
namespace NKG
{
public partial class NKG
{
public void Spikes()
{
GameObject holderin = GameObject.Find("Grimm Spike Holder");
GameObject holderout = GameObject.Instantiate(holderin);
holderin.name = "Grimm Spike Holder In";
holderout.name = "Grimm Spike Holder Out";
holderout.DisableChildren();
holderin.LocateMyFSM("Spike Control").GetValidState("Ready").GetFirstActionOfType<RandomFloatEither>().value1 = 67.125f;
holderout.LocateMyFSM("Spike Control").GetValidState("Ready").GetFirstActionOfType<RandomFloatEither>().value1 = 67.125f;
UnityEngine.Object[] array = UnityEngine.Object.FindObjectsOfType<GameObject>();
foreach (GameObject obj in array)
{
if (obj.name.Contains("Nightmare Spike"))
{
GameObject one = GameObject.Instantiate(obj);
GameObject two = GameObject.Instantiate(obj);
one.name = obj.name + "(Clone1)";
one.transform.position = obj.transform.position + new Vector3(1, 0, 0);
one.LocateMyFSM("Control").RemoveAction("Init", 1);
one.LocateMyFSM("Control").RemoveAction("Init", 3);
one.LocateMyFSM("Control").SetState("Init");
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(0.1f, () =>
{
one.LocateMyFSM("Control").SendEvent("FINISHED");
});
two.name = obj.name + "(Clone2)";
two.transform.position = obj.transform.position + new Vector3(2, 0, 0);
two.LocateMyFSM("Control").RemoveAction("Init", 1);
two.LocateMyFSM("Control").RemoveAction("Init", 3);
if (obj.name.Contains("4") || obj.name.Contains("5") || obj.name.Contains("6") || obj.name.Contains("7") || obj.name.Contains("8"))
{
one.transform.parent = holderin.transform;
two.transform.parent = holderin.transform;
obj.transform.parent = holderin.transform;
}
else
{
one.transform.parent = holderout.transform;
two.transform.parent = holderout.transform;
obj.transform.parent = holderout.transform;
}
two.LocateMyFSM("Control").SetState("Init");
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(0.1f, () =>
{
two.LocateMyFSM("Control").SendEvent("FINISHED");
});
}
}
spikeprefab = GameObject.Find("Nightmare Spike (1)");
GameObject.Find("Nightmare Spike").transform.SetScaleY(1.38f);
GameObject.Find("Nightmare Spike(Clone1)").transform.SetScaleY(1.38f);
GameObject.Find("Nightmare Spike(Clone2)").transform.SetScaleY(1.38f);
GameObject.Find("Nightmare Spike (12)(Clone1)").transform.SetScaleY(1.38f);
GameObject.Find("Nightmare Spike (12)").transform.SetScaleY(1.38f);
fsm.AddState("Spike Spawn");
fsm.ChangeTransition("Move Choice", "SPIKES", "Spike Spawn");
fsm.AddTransition("Spike Spawn", "OVER", "Spike Return");
fsm.InsertCustomAction("Spike Spawn", () =>
{
int bleh = UnityEngine.Random.Range(0, 2);
Log(bleh);
if (bleh == 0)
{
GameObject.Find("Grimm Spike Holder Out").LocateMyFSM("Spike Control").SendEvent("SPIKE ATTACK");
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(Constants.SpikeCooldown, () =>
GameObject.Find("Grimm Spike Holder In").LocateMyFSM("Spike Control").SendEvent("SPIKE ATTACK"));
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(2 * Constants.SpikeCooldown, () =>
GameObject.Find("Grimm Spike Holder Out").LocateMyFSM("Spike Control").SendEvent("SPIKE ATTACK"));
}
else
{
GameObject.Find("Grimm Spike Holder In").LocateMyFSM("Spike Control").SendEvent("SPIKE ATTACK");
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(Constants.SpikeCooldown, () =>
GameObject.Find("Grimm Spike Holder Out").LocateMyFSM("Spike Control").SendEvent("SPIKE ATTACK"));
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(2 * Constants.SpikeCooldown, () =>
GameObject.Find("Grimm Spike Holder In").LocateMyFSM("Spike Control").SendEvent("SPIKE ATTACK"));
}
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(4 * Constants.SpikeCooldown, () => fsm.SendEvent("OVER"));//1.85
}, 0);
}
public void RotationCancel()
{
UnityEngine.Object[] array = UnityEngine.Object.FindObjectsOfType<GameObject>();
foreach (GameObject obj in array)
{
if (obj.name.Contains("Nightmare Spike"))
{
obj.LocateMyFSM("Control").RemoveAction("Init", 1);
obj.LocateMyFSM("Control").RemoveAction("Init", 3);
obj.LocateMyFSM("Control").SetState("Init");
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(0.1f, () =>
{
obj.LocateMyFSM("Control").SendEvent("FINISHED");
});
}
}
}
}
}