-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathV2.cs
135 lines (108 loc) · 4.49 KB
/
V2.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
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
using AssetBundleLoader;
using Comfort.Common;
using EFT;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Systems.Effects;
using UnityEngine;
namespace ultramove
{
internal class V2 : UltraEnemy, IParryable
{
protected override float startingHealth => 10f;
bool crashedThroughRoof;
bool landed;
Animator animator;
Animator paneAnimator;
void Awake()
{
Light[] lights = GetComponentsInChildren<Light>();
for (int i = 0; i < lights.Length; i++)
{
if (lights[i].type == LightType.Spot)
lights[i].gameObject.GetOrAddComponent<VolumetricLight>();
}
animator = GetComponent<Animator>();
Singleton<GameWorld>.Instance.MainPlayer.Position = new Vector3(-91.9198f, 27.0865f, 156.2152f);
paneAnimator = Instantiate(BundleLoader.LoadAssetBundle(BundleLoader.GetDefaultModAssetBundlePath("ultrakill")).LoadAsset<GameObject>("skylight_glass_baked_prefab")).GetComponent<Animator>();
Material matGlass = new Material(Shader.Find("Global Fog/Transparent Reflective Specular"));
matGlass.mainTexture = BundleLoader.LoadAssetBundle(BundleLoader.GetDefaultModAssetBundlePath("ultrakill")).LoadAsset<Texture>("alpha32");
matGlass.SetFloat("_AlphaOffset", 0.45f);
matGlass.SetFloat("_Smoothness", 0.8f);
foreach (var meshRend in paneAnimator.GetComponentsInChildren<MeshRenderer>())
{
meshRend.sharedMaterial = matGlass;
}
// hiding the pallet that looks ugly
TransformExtensions.FindGameObjectWithComponentAtPosition<LODGroup>(new Vector3(-61.848f, 27.1f, 155.212f)).SetActive(false);
}
protected override void Revive()
{
base.Revive();
TODControl.SetTime(2, 0);
TOD_Sky.Instance.Components.Sky.transform.rotation = Quaternion.Euler(55.0908f, 32.3366f, 45.8764f);
crashedThroughRoof = false;
landed = false;
transform.position = new Vector3(-92.5f, 100f, 156.4f);
transform.localScale = Vector3.one * 0.5f;
transform.rotation = Quaternion.Euler(0, 90f, 0);
animator.Play("Intro", -1);
animator.speed = 0f;
animator.Rebind();
animator.Update(0f);
paneAnimator.gameObject.SetActive(false);
paneAnimator.Play("Action", -1);
paneAnimator.speed = 0f;
paneAnimator.Rebind();
paneAnimator.Update(0f);
}
void Update()
{
if (Input.GetKeyDown(KeyCode.L))
Revive();
if (!crashedThroughRoof && transform.position.y < 45.5f)
{
crashedThroughRoof = true;
PlayGlassCrashEffect();
Singleton<Effects>.Instance.Emit("Glass", transform.position, Vector3.down);
Singleton<Effects>.Instance.Emit("Glass", transform.position + new Vector3(-0.2f,0,0), Vector3.down * 2f);
Singleton<Effects>.Instance.Emit("Glass", transform.position, Vector3.down * 4f);
paneAnimator.gameObject.SetActive(true);
paneAnimator.speed = 1f;
Singleton<UltraTime>.Instance.SlowMo(1f, 0.4f);
}
if (!landed)
{
transform.position += new Vector3(0, Physics.gravity.y * Time.deltaTime, 0);
if (transform.position.y < 27.1f)
{
landed = true;
transform.position = new Vector3(transform.position.x, 27.0865f, transform.position.z);
Singleton<Effects>.Instance.Emit("big_round_impact", transform.position, Vector3.up);
CameraShaker.Shake(1f);
animator.speed = 1f;
Singleton<GameWorld>.Instance.MainPlayer.gameObject.GetComponent<UltraMovement>().Repel(transform.position);
}
}
}
void PlayGlassCrashEffect()
{
}
protected override void Die()
{
base.Die();
animator.Play("Death", -1);
}
public void Parry(Transform source)
{
if (!alive)
return;
DamageInfoStruct dmg = new DamageInfoStruct();
dmg.Damage = 5000f;
Hit(dmg);
}
}
}