using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Il2Cpp;
using Il2CppHurricaneVR.Framework.Core.Grabbers;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Reflection;
using MelonLoader;
using RedMod;
using UnityEngine;
using UnityEngine.Rendering;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "RedMod", "1.1.0", "YourName", null)]
[assembly: MelonGame("Kubunautilus", "BrutalistickVR")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("FireballMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FireballMod")]
[assembly: AssemblyTitle("FireballMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RedMod;
public class Core : MelonMod
{
private enum State
{
Idle,
Charging,
Ready,
Cooldown
}
public static HVRHexaBodyInputs playerInputs;
public static HVRHandGrabber leftHand;
public static HVRHandGrabber rightHand;
private State leftState = State.Idle;
private State rightState = State.Idle;
private GameObject leftBall;
private GameObject rightBall;
private float leftCharge;
private float rightCharge;
private bool wasLeftStick;
private bool wasRightStick;
private const float CHARGE_SPEED = 0.5f;
private const float MAX_CHARGE = 1f;
private const float MIN_SIZE = 0.02f;
private const float MAX_SIZE = 0.08f;
private const float SHOOT_SPEED = 15f;
private const float COOLDOWN = 0.4f;
private const float MIN_CHARGE_TO_SHOOT = 0.15f;
private const float RED_TRACK_LIFETIME = 5f;
private const float RED_EXPLOSION_RADIUS_MIN = 3f;
private const float RED_EXPLOSION_RADIUS_MAX = 7f;
private const float RED_EXPLOSION_POWER_MIN = 100f;
private const float RED_EXPLOSION_POWER_MAX = 300f;
private const float RED_EXPLOSION_DAMAGE_MIN = 30f;
private const float RED_EXPLOSION_DAMAGE_MAX = 100f;
private const int MAX_PARTICLES = 180;
private const float RED_FLIGHT_PARTICLE_INTERVAL = 0.06f;
private const int RED_EXPLOSION_PARTICLE_COUNT = 30;
private int activeParticles;
private Material redParticleMaterial;
public override void OnInitializeMelon()
{
((MelonBase)this).LoggerInstance.Msg("RedMod v1.1.0 — красный мод с частицами.");
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
ResetState();
if (sceneName == "MainMenuScene")
{
return;
}
GameObject val = GameObject.Find("Hexa4Rig26.10.23");
if ((Object)(object)val == (Object)null)
{
((MelonBase)this).LoggerInstance.Warning("Hexa4Rig26.10.23 не найден!");
return;
}
playerInputs = val.GetComponentInChildren<HVRHexaBodyInputs>();
Transform obj = val.transform.Find("Physics LeftHand");
leftHand = ((obj != null) ? ((Component)obj).GetComponent<HVRHandGrabber>() : null);
Transform obj2 = val.transform.Find("Physics RightHand");
rightHand = ((obj2 != null) ? ((Component)obj2).GetComponent<HVRHandGrabber>() : null);
if ((Object)(object)leftHand == (Object)null || (Object)(object)rightHand == (Object)null)
{
((MelonBase)this).LoggerInstance.Warning("Руки не найдены!");
}
else
{
((MelonBase)this).LoggerInstance.Msg("RedMod v1.1.0 загружен.");
}
}
private void ResetState()
{
leftState = State.Idle;
rightState = State.Idle;
leftBall = null;
rightBall = null;
leftCharge = 0f;
rightCharge = 0f;
wasLeftStick = false;
wasRightStick = false;
playerInputs = null;
leftHand = null;
rightHand = null;
activeParticles = 0;
if ((Object)(object)redParticleMaterial != (Object)null)
{
Object.Destroy((Object)(object)redParticleMaterial);
}
redParticleMaterial = null;
}
public override void OnUpdate()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)playerInputs == (Object)null) && !((Object)(object)playerInputs.LeftController == (Object)null) && !((Object)(object)playerInputs.RightController == (Object)null))
{
bool active = playerInputs.LeftController.JoystickButtonState.Active;
bool active2 = playerInputs.RightController.JoystickButtonState.Active;
ProcessHand(isLeft: true, active, wasLeftStick, ref leftState, ref leftBall, ref leftCharge, leftHand);
ProcessHand(isLeft: false, active2, wasRightStick, ref rightState, ref rightBall, ref rightCharge, rightHand);
wasLeftStick = active;
wasRightStick = active2;
}
}
private void ProcessHand(bool isLeft, bool stick, bool wasStick, ref State state, ref GameObject ball, ref float charge, HVRHandGrabber hand)
{
if ((Object)(object)hand == (Object)null)
{
return;
}
if (state == State.Idle)
{
if (stick && !wasStick)
{
state = State.Charging;
ball = CreateBall(((Component)hand).transform);
charge = 0f;
}
}
else if (state == State.Charging)
{
if (!stick && wasStick)
{
if (charge < 0.15f)
{
CancelBall(ref ball);
state = State.Cooldown;
MelonCoroutines.Start(ResetAfterCooldown(isLeft));
}
else
{
state = State.Ready;
}
}
else
{
charge += Time.deltaTime * 0.5f;
if (charge > 1f)
{
charge = 1f;
}
UpdateBall(ball, charge);
}
}
else if (state == State.Ready && stick && !wasStick)
{
Shoot(ball, ((Component)hand).transform, charge);
ball = null;
state = State.Cooldown;
MelonCoroutines.Start(ResetAfterCooldown(isLeft));
}
}
private GameObject CreateBall(Transform hand)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
Object.Destroy((Object)(object)val.GetComponent<Collider>());
((Object)val).name = "RedBall";
val.transform.SetParent(hand);
val.transform.localPosition = new Vector3(0f, 0.05f, 0.12f);
val.transform.localRotation = Quaternion.identity;
val.transform.localScale = Vector3.one * 0.02f;
Renderer component = val.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
Shader val2 = Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Standard");
if ((Object)(object)val2 != (Object)null)
{
component.material = new Material(val2);
component.material.color = new Color(1f, 0.3f, 0f);
}
component.shadowCastingMode = (ShadowCastingMode)0;
component.receiveShadows = false;
}
Light val3 = val.AddComponent<Light>();
val3.type = (LightType)2;
val3.color = new Color(1f, 0.4f, 0f);
val3.intensity = 5f;
val3.range = 3f;
return val;
}
private void UpdateBall(GameObject b, float charge)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)b == (Object)null))
{
float num = charge / 1f;
float num2 = Mathf.Lerp(0.02f, 0.08f, num);
b.transform.localScale = Vector3.one * num2;
Renderer component = b.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null && (Object)(object)component.material != (Object)null)
{
component.material.color = Color.Lerp(new Color(1f, 0.4f, 0.1f), new Color(1f, 0.1f, 0f), num);
}
Light component2 = b.GetComponent<Light>();
if ((Object)(object)component2 != (Object)null)
{
component2.intensity = Mathf.Lerp(5f, 10f, num);
component2.range = Mathf.Lerp(3f, 5f, num);
}
}
}
private void Shoot(GameObject b, Transform hand, float charge)
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)b == (Object)null))
{
b.transform.SetParent((Transform)null);
SphereCollider val = b.AddComponent<SphereCollider>();
val.radius = 0.5f;
((Collider)val).isTrigger = false;
Rigidbody val2 = b.AddComponent<Rigidbody>();
val2.useGravity = false;
val2.collisionDetectionMode = (CollisionDetectionMode)2;
float num = Mathf.Lerp(9f, 15f, charge / 1f);
val2.velocity = hand.forward * num;
TrailRenderer val3 = b.AddComponent<TrailRenderer>();
val3.time = 0.25f;
val3.startWidth = b.transform.localScale.x * 1.5f;
val3.endWidth = 0.005f;
val3.minVertexDistance = 0.15f;
Shader val4 = Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Standard");
if ((Object)(object)val4 != (Object)null)
{
Material val5 = new Material(val4);
val5.color = new Color(1f, 0.45f, 0f);
((Renderer)val3).material = val5;
}
val3.startColor = new Color(1f, 0.6f, 0f, 0.95f);
val3.endColor = new Color(1f, 0.1f, 0f, 0f);
MelonCoroutines.Start(RedTrack(b, charge));
}
}
private void CancelBall(ref GameObject ball)
{
if ((Object)(object)ball != (Object)null)
{
Object.Destroy((Object)(object)ball);
ball = null;
}
}
private IEnumerator ResetAfterCooldown(bool isLeft)
{
yield return (object)new WaitForSeconds(0.4f);
if (isLeft)
{
leftState = State.Idle;
}
else
{
rightState = State.Idle;
}
}
private IEnumerator RedTrack(GameObject ball, float charge)
{
yield return (object)new WaitForSeconds(0.05f);
if ((Object)(object)ball == (Object)null)
{
yield break;
}
Rigidbody rb = ball.GetComponent<Rigidbody>();
float startTime = Time.time;
float checkRadius = 0.4f;
float flightParticleTimer = 0f;
while ((Object)(object)ball != (Object)null && Time.time - startTime < 5f)
{
Vector3 pos = ball.transform.position;
Collider[] hits = Il2CppArrayBase<Collider>.op_Implicit((Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(pos, checkRadius));
Collider[] array = hits;
foreach (Collider hit in array)
{
if (!((Object)(object)hit == (Object)null) && !((Object)(object)((Component)hit).gameObject == (Object)null) && !((Object)(object)((Component)hit).gameObject == (Object)(object)ball) && !hit.isTrigger && !IsPlayer(((Component)hit).gameObject))
{
RedExplode(pos, charge);
Object.Destroy((Object)(object)ball);
yield break;
}
}
flightParticleTimer -= Time.deltaTime;
if (flightParticleTimer <= 0f)
{
Vector3 velocity = (((Object)(object)rb != (Object)null) ? rb.velocity : Vector3.zero);
SpawnRedFlightParticle(pos, velocity);
flightParticleTimer = 0.06f;
}
yield return null;
}
if ((Object)(object)ball != (Object)null)
{
Object.Destroy((Object)(object)ball);
}
}
private void RedExplode(Vector3 position, float charge)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Clamp01(charge / 1f);
float num2 = Mathf.Lerp(3f, 7f, num);
float num3 = Mathf.Lerp(100f, 300f, num);
float damage = Mathf.Lerp(30f, 100f, num);
Collider[] array = Il2CppArrayBase<Collider>.op_Implicit((Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(position, num2));
Collider[] array2 = array;
foreach (Collider val in array2)
{
if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && !IsPlayer(((Component)val).gameObject))
{
Rigidbody component = ((Component)val).GetComponent<Rigidbody>();
if ((Object)(object)component != (Object)null)
{
component.AddExplosionForce(num3, position, num2, 1f, (ForceMode)1);
}
ApplyDamage(((Component)val).gameObject, position, damage, num2);
}
}
SpawnRedExplosionEffect(position, num2);
SpawnRedExplosionParticles(position, num2);
}
private void SpawnRedExplosionEffect(Vector3 position, float radius)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
Object.Destroy((Object)(object)val.GetComponent<Collider>());
((Object)val).name = "RedExplosion";
val.transform.position = position;
val.transform.localScale = Vector3.one * 0.1f;
Renderer component = val.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
Shader val2 = Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Standard");
if ((Object)(object)val2 != (Object)null)
{
component.material = new Material(val2);
component.material.color = new Color(1f, 0.4f, 0f);
}
component.shadowCastingMode = (ShadowCastingMode)0;
component.receiveShadows = false;
}
Light val3 = val.AddComponent<Light>();
val3.type = (LightType)2;
val3.color = new Color(1f, 0.6f, 0.1f);
val3.intensity = 25f;
val3.range = radius * 3f;
MelonCoroutines.Start(RedExplosionAnimation(val, val3, radius));
}
private IEnumerator RedExplosionAnimation(GameObject explosion, Light flash, float radius)
{
float duration = 0.3f;
float elapsed = 0f;
Vector3 startScale = Vector3.one * 0.1f;
Vector3 maxScale = Vector3.one * Mathf.Max(2.5f, radius * 0.5f);
while (elapsed < duration && (Object)(object)explosion != (Object)null)
{
elapsed += Time.deltaTime;
float t = elapsed / duration;
explosion.transform.localScale = Vector3.Lerp(startScale, maxScale, t);
if ((Object)(object)flash != (Object)null)
{
flash.intensity = Mathf.Lerp(25f, 0f, t * t);
}
Renderer r = explosion.GetComponent<Renderer>();
if ((Object)(object)r != (Object)null && (Object)(object)r.material != (Object)null)
{
r.material.color = Color.Lerp(new Color(1f, 0.4f, 0f), new Color(0.3f, 0.05f, 0f), t);
}
yield return null;
}
if ((Object)(object)explosion != (Object)null)
{
Object.Destroy((Object)(object)explosion);
}
}
private Material GetRedParticleMaterial()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)redParticleMaterial != (Object)null)
{
return redParticleMaterial;
}
Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Standard");
if ((Object)(object)val != (Object)null)
{
redParticleMaterial = new Material(val);
redParticleMaterial.color = new Color(1f, 0.45f, 0.1f);
}
return redParticleMaterial;
}
private void SetupParticleRenderer(GameObject particle)
{
if ((Object)(object)particle == (Object)null)
{
return;
}
Renderer component = particle.GetComponent<Renderer>();
if (!((Object)(object)component == (Object)null))
{
Material val = GetRedParticleMaterial();
if ((Object)(object)val != (Object)null)
{
component.material = val;
}
component.shadowCastingMode = (ShadowCastingMode)0;
component.receiveShadows = false;
}
}
private void SpawnRedFlightParticle(Vector3 position, Vector3 velocity)
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
if (activeParticles >= 180)
{
return;
}
GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
if (!((Object)(object)val == (Object)null))
{
activeParticles++;
Object.Destroy((Object)(object)val.GetComponent<Collider>());
((Object)val).name = "RedFlightParticle";
Vector3 val2 = Random.insideUnitSphere * 0.06f;
if (((Vector3)(ref velocity)).sqrMagnitude > 0.001f)
{
val2 += -((Vector3)(ref velocity)).normalized * 0.05f;
}
val.transform.position = position + val2;
float num = Random.Range(0.004f, 0.012f);
val.transform.localScale = Vector3.one * num;
SetupParticleRenderer(val);
Vector3 val3 = Random.insideUnitSphere * 0.12f;
if (((Vector3)(ref velocity)).sqrMagnitude > 0.001f)
{
val3 += -((Vector3)(ref velocity)).normalized * 0.08f;
}
float life = Random.Range(0.25f, 0.55f);
MelonCoroutines.Start(RedFlightParticleRoutine(val, val3, life));
}
}
private IEnumerator RedFlightParticleRoutine(GameObject particle, Vector3 drift, float life)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)particle == (Object)null)
{
if (activeParticles > 0)
{
activeParticles--;
}
yield break;
}
Vector3 startScale = particle.transform.localScale;
float elapsed = 0f;
while ((Object)(object)particle != (Object)null && elapsed < life)
{
float dt = Time.deltaTime;
Vector3 pos = particle.transform.position;
particle.transform.position = pos + drift * dt;
drift *= 0.94f;
elapsed += dt;
float t = elapsed / life;
particle.transform.localScale = startScale * Mathf.Clamp01(1f - t);
yield return null;
}
if ((Object)(object)particle != (Object)null)
{
Object.Destroy((Object)(object)particle);
}
if (activeParticles > 0)
{
activeParticles--;
}
}
private void SpawnRedExplosionParticles(Vector3 center, float radius)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < 30; i++)
{
if (activeParticles >= 180)
{
break;
}
GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
if (!((Object)(object)val == (Object)null))
{
activeParticles++;
Object.Destroy((Object)(object)val.GetComponent<Collider>());
((Object)val).name = "RedExplosionParticle";
Vector3 onUnitSphere = Random.onUnitSphere;
val.transform.position = center + onUnitSphere * 0.1f;
float num = Random.Range(0.01f, 0.035f);
val.transform.localScale = Vector3.one * num;
SetupParticleRenderer(val);
float num2 = Random.Range(5f, 11f) + radius * 0.6f;
Vector3 velocity = onUnitSphere * num2;
float outwardTime = Random.Range(0.25f, 0.45f);
float floatTime = Random.Range(0.6f, 1.2f);
float implodeTime = Random.Range(0.5f, 0.9f);
MelonCoroutines.Start(RedExplosionParticleRoutine(val, center, velocity, outwardTime, floatTime, implodeTime));
}
}
}
private IEnumerator RedExplosionParticleRoutine(GameObject particle, Vector3 center, Vector3 velocity, float outwardTime, float floatTime, float implodeTime)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)particle == (Object)null)
{
if (activeParticles > 0)
{
activeParticles--;
}
yield break;
}
Vector3 startScale = particle.transform.localScale;
float elapsed = 0f;
while ((Object)(object)particle != (Object)null && elapsed < outwardTime)
{
float dt = Time.deltaTime;
Vector3 pos = particle.transform.position;
particle.transform.position = pos + velocity * dt;
velocity *= 0.88f;
elapsed += dt;
yield return null;
}
elapsed = 0f;
Vector3 drift = Random.insideUnitSphere * 0.3f;
while ((Object)(object)particle != (Object)null && elapsed < floatTime)
{
float dt2 = Time.deltaTime;
Vector3 pos2 = particle.transform.position;
particle.transform.position = pos2 + drift * dt2;
drift *= 0.96f;
elapsed += dt2;
yield return null;
}
elapsed = 0f;
while ((Object)(object)particle != (Object)null && elapsed < implodeTime)
{
float dt3 = Time.deltaTime;
float t = elapsed / implodeTime;
Vector3 pos3 = particle.transform.position;
float distanceToCenter = Vector3.Distance(pos3, center);
float speed = Mathf.Lerp(3f, 18f, t) + distanceToCenter * 2f;
Vector3 newPos = Vector3.MoveTowards(pos3, center, speed * dt3);
particle.transform.position = newPos;
particle.transform.localScale = startScale * Mathf.Clamp01(1f - t);
if (Vector3.Distance(newPos, center) < 0.05f)
{
break;
}
elapsed += dt3;
yield return null;
}
if ((Object)(object)particle != (Object)null)
{
Object.Destroy((Object)(object)particle);
}
if (activeParticles > 0)
{
activeParticles--;
}
}
private bool IsPlayer(GameObject go)
{
if ((Object)(object)go == (Object)null)
{
return false;
}
Transform root = go.transform.root;
string text = (((Object)(object)root != (Object)null) ? ((Object)root).name : ((Object)go).name);
if (string.IsNullOrEmpty(text))
{
return false;
}
return text.Contains("Hexa4Rig") || text.Contains("Player");
}
private void ApplyDamage(GameObject target, Vector3 hitPosition, float damage, float radius)
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
Component val = FindIl2CppComponent(target, "StickHealth");
if ((Object)(object)val == (Object)null && (Object)(object)target.transform.parent != (Object)null)
{
val = FindIl2CppComponent(((Component)target.transform.parent).gameObject, "StickHealth");
}
if ((Object)(object)val == (Object)null)
{
return;
}
Type type = ((object)val).GetType();
float num = Vector3.Distance(hitPosition, target.transform.position);
float num2 = 1f - num / radius;
float num3 = damage * Mathf.Clamp01(num2);
MethodInfo method = type.GetMethod("HitByBullet");
if (method != null)
{
try
{
method.Invoke(val, new object[3] { hitPosition, num3, false });
return;
}
catch
{
}
}
MethodInfo method2 = type.GetMethod("ReceivedGeneralDamage");
if (method2 != null)
{
try
{
Type nestedType = type.GetNestedType("DamageType");
object obj2 = 1;
if (nestedType != null && nestedType.IsEnum)
{
try
{
obj2 = Enum.Parse(nestedType, "Explosion");
}
catch
{
obj2 = Convert.ChangeType(1, nestedType);
}
}
method2.Invoke(val, new object[4] { num3, obj2, "torso", null });
return;
}
catch
{
}
}
MethodInfo method3 = type.GetMethod("KillZoneEntered");
if (!(method3 != null))
{
return;
}
try
{
method3.Invoke(val, null);
}
catch
{
}
}
private Component FindIl2CppComponent(GameObject go, string typeName)
{
if ((Object)(object)go == (Object)null)
{
return null;
}
Il2CppArrayBase<Component> components = go.GetComponents<Component>();
if (components == null)
{
return null;
}
foreach (Component item in components)
{
if ((Object)(object)item == (Object)null || !(((MemberInfo)((Object)item).GetIl2CppType()).Name == typeName))
{
continue;
}
return item;
}
return null;
}
}