-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModClass.cs
More file actions
189 lines (154 loc) · 8.24 KB
/
Copy pathModClass.cs
File metadata and controls
189 lines (154 loc) · 8.24 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using HutongGames.PlayMaker.Ecosystem.Utils;
using InControl;
using Modding;
using Satchel;
//using SFCore.Utils;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using Satchel.Futils;
using Satchel.Futils.Serialiser;
namespace NKG
{
public partial class NKG : Mod
{
public NKG() : base("NKG") { }
public override string GetVersion() => "1.0";
public override void Initialize()
{
UnityEngine.SceneManagement.SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;
ModHooks.HeroUpdateHook += ModHooks_HeroUpdateHook;
}
private void ModHooks_HeroUpdateHook()
{
if (Input.GetKeyDown(KeyCode.P))
{
//Log(GameObject.Find("Nightmare Grimm Boss").LocateMyFSM("Control").ActiveStateName);
//Log(GameObject.Find("Nightmare Spike").LocateMyFSM("Control").ActiveStateName);
var afterburn = Resources.FindObjectsOfTypeAll<GameObject>()
.FirstOrDefault(x => x.name == "Pt Afterburn");
var copy = GameObject.Instantiate(afterburn);
copy.transform.position = Knight.transform.position;
copy.SetActive(true);
//Log(GameObject.Find("Nightmare Grimm Boss").LocateMyFSM("Control").FsmVariables.GetFsmBool("First Move").Value);
}
if (Input.GetKeyDown(KeyCode.K))
{
//GameObject.Find("Nightmare Grimm Boss").LocateMyFSM("Control").SendEvent("OVER");
}
}
private void SceneManager_activeSceneChanged(UnityEngine.SceneManagement.Scene arg0, UnityEngine.SceneManagement.Scene arg1)
{
if (arg1.name.Contains("Nightmare"))
{
RotationCancel();
GameManager.instance.StartCoroutine(NKGfsm());
}
}
public int finish;
public GameObject Nkg = null;
public PlayMakerFSM fsm = null;
public GameObject Knight = null;
public GameObject flameprefab = null;
public GameObject afterburnprefab = null;
public GameObject spikeprefab = null;
public IEnumerator NKGfsm()
{
yield return new WaitForFinishedEnteringScene();
Nkg = GameObject.Find("Nightmare Grimm Boss");
fsm = Nkg.LocateMyFSM("Control");
Knight = GameObject.Find("Knight");
Skip(GameObject.Find("Grimm Control").LocateMyFSM("Control"));
flameprefab = Resources.FindObjectsOfTypeAll<GameObject>().FirstOrDefault(x => x.name == "Nightmare UP Ball");
afterburnprefab = Resources.FindObjectsOfTypeAll<GameObject>().FirstOrDefault(x => x.name == "Pt Afterburn");
fsm.GetFirstActionOfType<Wait>("Out Pause").time = Constants.OffScreen;
Dash();
Attack();
Spikes();
Pillars();
Bats();
fsm.InsertCustomAction("AD Tele In", () =>
{
fsm.FsmVariables.GetFsmFloat("Tele X").Value = Knight.transform.position.x;
}, 3);
fsm.GetFirstActionOfType<SetPosition>("AD Tele In").y = 18f;
fsm.GetFirstActionOfType<SetVelocityAsAngle>("AD Fire").angle = 270;
fsm.ChangeTransition("GD Antic", "NEXT", "Tele Out");
GameObject ball2 = GameObject.Instantiate(afterburnprefab);
fsm.AddState("GD Explosion");
fsm.ChangeTransition("AD Fire", "LAND", "GD Explosion");
fsm.AddTransition("GD Explosion", "OVER", "GD Antic");
fsm.InsertCustomAction("GD Explosion", () =>
{
ball2.hideFlags = HideFlags.None;
ball2.transform.position = Nkg.transform.position - new Vector3(0, 1, 0);
ball2.transform.localScale = new Vector3 (1, 1, 1);
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(0.1f, () => ball2.GetComponent<CircleCollider2D>().enabled = true);
var wawar = ball2.GetComponent<ParticleSystem>().main;
wawar.startLifetime = 0.4f;
wawar.startSizeX = 10f;
wawar.startSizeY = 10f;
ball2.GetComponent<ParticleSystem>().Clear();
ball2.GetComponent<ParticleSystem>().Play();
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(0.5f, () => ball2.GetComponent<CircleCollider2D>().enabled = false);
for(int i=0; i<3; i++)
{
GameObject flame1 = GameObject.Instantiate(flameprefab);
flame1.transform.localScale = new Vector3(1.7f, 1.7f, 1);
//flame1.name += "DeleteTag";
flame1.transform.position = Nkg.transform.position + new Vector3(0, 1, 0);
Rigidbody2D rb1 = flame1.GetComponent<Rigidbody2D>();
rb1.velocity = new Vector2(20f, 30f);
GameObject flame2 = GameObject.Instantiate(flameprefab);
flame2.transform.localScale = new Vector3(1.7f, 1.7f, 1);
flame2.transform.position = Nkg.transform.position + new Vector3(0, 1, 0);
Rigidbody2D rb2 = flame2.GetComponent<Rigidbody2D>();
rb2.velocity = new Vector2(-20f, 30f);
GameObject flame3 = GameObject.Instantiate(flameprefab);
flame3.transform.localScale = new Vector3(2f, 2f, 1);
flame3.transform.position = Nkg.transform.position - new Vector3 (0, 1, 0);
Rigidbody2D rb3 = flame3.GetComponent<Rigidbody2D>();
rb3.velocity = new Vector2(40f, -10f);
GameObject flame4 = GameObject.Instantiate(flameprefab);
flame4.transform.localScale = new Vector3(2f, 2f, 1);
flame4.transform.position = Nkg.transform.position - new Vector3(0, 1, 0);
Rigidbody2D rb4 = flame4.GetComponent<Rigidbody2D>();
rb4.velocity = new Vector2(-40f, -10f);
}
float spa = Constants.DiveSpikeSpacing;
for (float i = -3*spa; i <= 3*spa; i += spa)
{
if(i!= 0 && Nkg.transform.position.x + i >= 68 && Nkg.transform.position.x + i <= 103)
{
GameObject side1 = GameObject.Instantiate(spikeprefab);
side1.transform.position = new Vector3(Nkg.transform.position.x + i, 4.6f, 0);
PlayMakerFSM fide1 = side1.LocateMyFSM("Control");
fide1.ChangeTransition("Dormant", "SPIKES READY", "Ready");
fide1.SendEvent("SPIKES READY");
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(Constants.DiveSpikeSpawn, () => fide1.SendEvent("SPIKES UP"));
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(Constants.DiveSpikeDecay, () => fide1.SendEvent("SPIKES DOWN"));
Satchel.CoroutineHelper.WaitForSecondsBeforeInvoke(Constants.DiveSpikeDecay + 1, () => GameObject.Destroy(side1));
}
}
fsm.SendEvent("OVER");
}, 0);
}
/*private void Flamer(PlayMakerFSM fsm, string s, int n)
{
fsm.InsertAction(s, new SpawnObjectFromGlobalPoolOverTime
{
gameObject = fsm.GetValidState("AD Fire").GetFirstActionOfType<SpawnObjectFromGlobalPoolOverTime>().gameObject,
spawnPoint = fsm.GetValidState("AD Fire").GetFirstActionOfType<SpawnObjectFromGlobalPoolOverTime>().spawnPoint,
position = fsm.GetValidState("AD Fire").GetFirstActionOfType<SpawnObjectFromGlobalPoolOverTime>().position,
rotation = fsm.GetValidState("AD Fire").GetFirstActionOfType<SpawnObjectFromGlobalPoolOverTime>().rotation,
frequency = fsm.GetValidState("AD Fire").GetFirstActionOfType<SpawnObjectFromGlobalPoolOverTime>().frequency
}, n);
}*/
//fsm.GetValidState("Knight 1").GetFirstActionOfType<IntCompare>().integer2 = new FsmInt { Value = 10 };
}
}