using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using DM;
using EzECS.Barriers;
using HarmonyLib;
using HiddenUnits.Properties;
using Landfall.TABC;
using Landfall.TABS;
using Landfall.TABS.AI;
using Landfall.TABS.AI.Components;
using Landfall.TABS.AI.Components.Modifiers;
using Landfall.TABS.AI.Components.Tags;
using Landfall.TABS.AI.Systems;
using Landfall.TABS.GameMode;
using Landfall.TABS.GameState;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using Microsoft.CodeAnalysis;
using Pathfinding;
using Photon.Bolt;
using RootMotion.FinalIK;
using TFBGames;
using TGCore;
using TGCore.Library;
using TGCore.Localization;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("HiddenUnits")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1563b51b32be5a6d689e68d77bcf12e1462a149d")]
[assembly: AssemblyProduct("HiddenUnits")]
[assembly: AssemblyTitle("HiddenUnits")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public class ClubSpell : TargetableEffect
{
public AnimationCurve upCurve;
public AnimationCurve forceCurve;
public float force;
private float RockStartY;
private Rigidbody Rig;
private Vector3 Direction;
private Vector3 StartPos;
public float prediction = 1f;
private Rigidbody Target;
public void Start()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
StartPos = ((Component)this).transform.position;
}
private IEnumerator Go()
{
float t3 = ((Keyframe)(ref upCurve.keys[upCurve.keys.Length - 1])).time;
float c3 = 0f;
while (c3 < t3)
{
c3 += Time.deltaTime;
((Component)Rig).transform.localPosition = new Vector3(0f, upCurve.Evaluate(c3) + RockStartY, 0f);
yield return null;
}
Rig.isKinematic = false;
t3 = ((Keyframe)(ref forceCurve.keys[forceCurve.keys.Length - 1])).time;
c3 = 0f;
GetDirection(Rig.position, Target.position, Target);
Rig.useGravity = false;
while (c3 < t3)
{
c3 += Time.deltaTime;
Rig.velocity = Direction * (forceCurve.Evaluate(c3) * force);
yield return null;
}
Rig.useGravity = true;
}
public override void DoEffect(Transform startPoint, Transform endPoint)
{
}
public override void DoEffect(Vector3 startPoint, Vector3 endPoint, Rigidbody targetRig = null)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
Target = targetRig;
Rig = ((Component)this).GetComponentInChildren<Rigidbody>();
RockStartY = ((Component)Rig).transform.localPosition.y;
((MonoBehaviour)this).StartCoroutine(Go());
}
public void DoSpell()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
Rigidbody targetMainRig = ((Component)((Component)this).transform.root).GetComponent<Unit>().data.targetMainRig;
((TargetableEffect)this).DoEffect(StartPos, targetMainRig.position, targetMainRig);
}
private void GetDirection(Vector3 startPoint, Vector3 endPoint, Rigidbody targetRig)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//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_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_0038: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = endPoint;
val += targetRig.velocity * (prediction * 0.1f * Vector3.Distance(startPoint, val));
Vector3 val2 = val - startPoint;
Direction = ((Vector3)(ref val2)).normalized;
}
}
public class DodgeMovePhoenix : Move, IRemotelyControllable
{
[HideInInspector]
public Transform targetObject;
public float animationSpeed = 1f;
public float animationSpeedWhenPositiveCurve = 1f;
public float forceMultiplier = 1f;
public bool divideForceByMass;
public bool cancelSelf;
public bool usedAsMovement;
public bool randomForceMultiplier;
public float minRange;
public float maxRange;
public CombatMoveDataInstance[] moves;
[SerializeField]
[Tooltip("See the comments in code.")]
protected bool allowForMartian;
private float RandomSeed;
private DataHandler Data;
private RigidbodyHolder AllRigs;
private CameraAbilityPossess Possess;
public bool IsRemotelyControlled { get; private set; }
private void Start()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Invalid comparison between Unknown and I4
Data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
AllRigs = ((Component)Data).GetComponent<RigidbodyHolder>();
for (int i = 0; i < moves.Length; i++)
{
if ((int)moves[i].forceDirection == 15)
{
Possess = ((Component)MainCam.instance).GetComponentInParent<CameraAbilityPossess>();
}
}
if (randomForceMultiplier)
{
RandomSeed = Random.Range(-1, 1);
forceMultiplier = Random.Range(forceMultiplier * 0.7f, forceMultiplier);
if (RandomSeed < 0f)
{
forceMultiplier = 0f - forceMultiplier;
}
}
}
public void DoMove(Transform targetObj)
{
targetObject = targetObj;
DoMove();
}
public void DoMove()
{
if (!Object.op_Implicit((Object)(object)Data))
{
Data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
AllRigs = ((Component)Data).GetComponent<RigidbodyHolder>();
}
((Move)this).DoMove((Rigidbody)null, Data.targetMainRig, Data.targetData);
}
public override void DoMove(Rigidbody enemyWeapon, Rigidbody enemyTorso, DataHandler targetData)
{
if (cancelSelf)
{
((MonoBehaviour)this).StopAllCoroutines();
}
if (!Object.op_Implicit((Object)(object)enemyWeapon) && !Object.op_Implicit((Object)(object)enemyTorso))
{
return;
}
for (int i = 0; i < moves.Length; i++)
{
CombatMoveDataInstance move = moves[i];
if (IsAllowedToDoMoveInMultiplayer(move))
{
((MonoBehaviour)this).StartCoroutine(DoMoveSequence(move, enemyWeapon, enemyTorso, targetData));
}
}
}
private IEnumerator DoMoveSequence(CombatMoveDataInstance move, Rigidbody enemyWeapon, Rigidbody enemyTorso, DataHandler targetData)
{
float t = ((Keyframe)(ref move.forceCurve.keys[move.forceCurve.keys.Length - 1])).time;
float c = 0f;
if (move.useAlternateForceProjectMarsClient && BoltNetwork.IsClient)
{
move.force = move.alternateClientForce;
}
move.randomMultiplier = move.randomCurve.Evaluate(Random.value);
List<Rigidbody> rigs = new List<Rigidbody>();
if ((int)move.rigidbodyToMove == 0)
{
rigs.Add(((Component)Data.head).GetComponent<Rigidbody>());
}
else if ((int)move.rigidbodyToMove == 1)
{
if (Object.op_Implicit((Object)(object)Data.torso))
{
rigs.Add(((Component)Data.torso).GetComponent<Rigidbody>());
}
}
else if ((int)move.rigidbodyToMove == 2)
{
if (Object.op_Implicit((Object)(object)Data.hip))
{
rigs.Add(((Component)Data.hip).GetComponent<Rigidbody>());
}
}
else if ((int)move.rigidbodyToMove == 3)
{
if (Object.op_Implicit((Object)(object)Data.footLeft))
{
rigs.Add(((Component)Data.footLeft).GetComponent<Rigidbody>());
}
}
else if ((int)move.rigidbodyToMove == 4)
{
if (Object.op_Implicit((Object)(object)Data.footRight))
{
rigs.Add(((Component)Data.footRight).GetComponent<Rigidbody>());
}
}
else if ((int)move.rigidbodyToMove == 7)
{
if (Object.op_Implicit((Object)(object)Data.rightHand))
{
rigs.Add(((Component)Data.rightHand).GetComponent<Rigidbody>());
}
}
else if ((int)move.rigidbodyToMove == 6)
{
if (Object.op_Implicit((Object)(object)Data.leftHand))
{
rigs.Add(((Component)Data.leftHand).GetComponent<Rigidbody>());
}
}
else if ((int)move.rigidbodyToMove == 5)
{
rigs.AddRange(AllRigs.AllRigs);
}
else if ((int)move.rigidbodyToMove == 8)
{
WeaponHandler weaponHandler = Data.weaponHandler;
if (Object.op_Implicit((Object)(object)weaponHandler))
{
if (Object.op_Implicit((Object)(object)weaponHandler.rightWeapon) && Object.op_Implicit((Object)(object)weaponHandler.rightWeapon.rigidbody))
{
rigs.Add(weaponHandler.rightWeapon.rigidbody);
}
else if (Object.op_Implicit((Object)(object)weaponHandler.leftWeapon) && Object.op_Implicit((Object)(object)weaponHandler.leftWeapon.rigidbody))
{
rigs.Add(weaponHandler.leftWeapon.rigidbody);
}
}
}
else if ((int)move.rigidbodyToMove == 9)
{
rigs.Add(((Component)this).GetComponent<Rigidbody>());
}
else if ((int)move.rigidbodyToMove == 10 && Object.op_Implicit((Object)(object)move.specificRig))
{
rigs.Add(move.specificRig);
}
if (move.includeWeapons)
{
WeaponHandler weaponHandler2 = Data.weaponHandler;
if (Object.op_Implicit((Object)(object)weaponHandler2))
{
if (Object.op_Implicit((Object)(object)weaponHandler2.leftWeapon) && Object.op_Implicit((Object)(object)weaponHandler2.leftWeapon.rigidbody))
{
rigs.Add(weaponHandler2.leftWeapon.rigidbody);
}
if (Object.op_Implicit((Object)(object)weaponHandler2.rightWeapon) && Object.op_Implicit((Object)(object)weaponHandler2.rightWeapon.rigidbody))
{
rigs.Add(weaponHandler2.rightWeapon.rigidbody);
}
}
}
Vector3 forceDirection = Vector3.zero;
if (rigs.Count >= 1)
{
forceDirection = GetDirection(move, enemyWeapon, enemyTorso, rigs[0], targetData);
for (int num = rigs.Count - 1; num >= 0; num--)
{
if ((Object)(object)rigs[num] == (Object)null)
{
rigs.RemoveAt(num);
}
}
}
float massM = 1f;
if (divideForceByMass)
{
float num2 = 0f;
for (int i = 0; i < rigs.Count; i++)
{
num2 += rigs[i].mass / (float)rigs.Count;
}
massM = 1f / num2;
}
while (c < t)
{
if (CheckConditions())
{
for (int j = 0; j < rigs.Count; j++)
{
if (move.setDirectionContiniouiouss)
{
forceDirection = GetDirection(move, enemyWeapon, enemyTorso, rigs[0], targetData);
}
if (!usedAsMovement || !Object.op_Implicit((Object)(object)Data) || !Object.op_Implicit((Object)(object)((Component)Data).GetComponent<AnimationHandler>()) || ((Component)Data).GetComponent<AnimationHandler>().currentState != 0)
{
if (move.force != 0f && Object.op_Implicit((Object)(object)rigs[j]))
{
rigs[j].AddForce(forceDirection * massM * move.randomMultiplier * forceMultiplier * move.force * move.forceCurve.Evaluate(c), (ForceMode)5);
}
if (move.torque != 0f && Object.op_Implicit((Object)(object)rigs[j]))
{
rigs[j].AddTorque(forceDirection * massM * forceMultiplier * move.torque * move.forceCurve.Evaluate(c), (ForceMode)5);
}
}
}
}
float num3 = 1f;
num3 *= animationSpeed;
if (move.forceCurve.Evaluate(c) > 0f)
{
num3 *= animationSpeedWhenPositiveCurve;
}
c += Time.fixedDeltaTime * num3;
yield return (object)new WaitForFixedUpdate();
}
}
private bool CheckConditions()
{
bool result = true;
if (maxRange != 0f && Object.op_Implicit((Object)(object)Data) && Data.distanceToTarget > maxRange)
{
result = false;
}
if (minRange != 0f && Object.op_Implicit((Object)(object)Data) && Data.distanceToTarget < minRange)
{
result = false;
}
return result;
}
private Vector3 GetDirection(CombatMoveDataInstance move, Rigidbody enemyWeapon, Rigidbody enemyTorso, Rigidbody ownRig, DataHandler targetData)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Invalid comparison between Unknown and I4
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Invalid comparison between Unknown and I4
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Invalid comparison between Unknown and I4
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Invalid comparison between Unknown and I4
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Invalid comparison between Unknown and I4
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: 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_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Invalid comparison between Unknown and I4
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0760: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: 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_00df: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Invalid comparison between Unknown and I4
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: 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_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Invalid comparison between Unknown and I4
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Invalid comparison between Unknown and I4
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0421: Unknown result type (might be due to invalid IL or missing references)
//IL_0427: Invalid comparison between Unknown and I4
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_0499: Unknown result type (might be due to invalid IL or missing references)
//IL_04a0: Invalid comparison between Unknown and I4
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
//IL_05bf: Invalid comparison between Unknown and I4
//IL_0612: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Invalid comparison between Unknown and I4
//IL_043b: Unknown result type (might be due to invalid IL or missing references)
//IL_0442: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_0453: Unknown result type (might be due to invalid IL or missing references)
//IL_0458: Unknown result type (might be due to invalid IL or missing references)
//IL_045d: Unknown result type (might be due to invalid IL or missing references)
//IL_0460: Unknown result type (might be due to invalid IL or missing references)
//IL_0465: Unknown result type (might be due to invalid IL or missing references)
//IL_046b: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Unknown result type (might be due to invalid IL or missing references)
//IL_0477: Unknown result type (might be due to invalid IL or missing references)
//IL_0483: Unknown result type (might be due to invalid IL or missing references)
//IL_048d: Unknown result type (might be due to invalid IL or missing references)
//IL_0492: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
//IL_03db: Unknown result type (might be due to invalid IL or missing references)
//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Unknown result type (might be due to invalid IL or missing references)
//IL_066c: Unknown result type (might be due to invalid IL or missing references)
//IL_0673: Invalid comparison between Unknown and I4
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_068c: Unknown result type (might be due to invalid IL or missing references)
//IL_0693: Invalid comparison between Unknown and I4
//IL_0680: Unknown result type (might be due to invalid IL or missing references)
//IL_0685: Unknown result type (might be due to invalid IL or missing references)
//IL_05de: Unknown result type (might be due to invalid IL or missing references)
//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0506: Unknown result type (might be due to invalid IL or missing references)
//IL_0510: Unknown result type (might be due to invalid IL or missing references)
//IL_0515: Unknown result type (might be due to invalid IL or missing references)
//IL_051c: Unknown result type (might be due to invalid IL or missing references)
//IL_0521: Unknown result type (might be due to invalid IL or missing references)
//IL_052d: Unknown result type (might be due to invalid IL or missing references)
//IL_0532: Unknown result type (might be due to invalid IL or missing references)
//IL_0537: Unknown result type (might be due to invalid IL or missing references)
//IL_053a: Unknown result type (might be due to invalid IL or missing references)
//IL_053f: Unknown result type (might be due to invalid IL or missing references)
//IL_054b: Unknown result type (might be due to invalid IL or missing references)
//IL_055c: Unknown result type (might be due to invalid IL or missing references)
//IL_0566: Unknown result type (might be due to invalid IL or missing references)
//IL_056b: Unknown result type (might be due to invalid IL or missing references)
//IL_057c: Unknown result type (might be due to invalid IL or missing references)
//IL_0586: Unknown result type (might be due to invalid IL or missing references)
//IL_058b: Unknown result type (might be due to invalid IL or missing references)
//IL_0592: Unknown result type (might be due to invalid IL or missing references)
//IL_0597: Unknown result type (might be due to invalid IL or missing references)
//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
//IL_069c: Unknown result type (might be due to invalid IL or missing references)
//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
//IL_06b6: Unknown result type (might be due to invalid IL or missing references)
//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
//IL_06c5: Unknown result type (might be due to invalid IL or missing references)
//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
//IL_06df: Unknown result type (might be due to invalid IL or missing references)
//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0631: Unknown result type (might be due to invalid IL or missing references)
//IL_0638: Unknown result type (might be due to invalid IL or missing references)
//IL_0643: Unknown result type (might be due to invalid IL or missing references)
//IL_0648: Unknown result type (might be due to invalid IL or missing references)
//IL_064d: Unknown result type (might be due to invalid IL or missing references)
//IL_0652: Unknown result type (might be due to invalid IL or missing references)
//IL_0606: Unknown result type (might be due to invalid IL or missing references)
//IL_060b: Unknown result type (might be due to invalid IL or missing references)
//IL_070a: Unknown result type (might be due to invalid IL or missing references)
//IL_0711: Invalid comparison between Unknown and I4
//IL_0660: Unknown result type (might be due to invalid IL or missing references)
//IL_0665: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_0389: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0701: Unknown result type (might be due to invalid IL or missing references)
//IL_0706: Unknown result type (might be due to invalid IL or missing references)
//IL_0727: Unknown result type (might be due to invalid IL or missing references)
//IL_0733: Unknown result type (might be due to invalid IL or missing references)
//IL_0744: Unknown result type (might be due to invalid IL or missing references)
//IL_0750: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)enemyTorso))
{
enemyTorso = Data.targetData.mainRig;
}
Vector3 val = Vector3.zero;
if ((Object)(object)ownRig == (Object)null)
{
return val;
}
if ((int)move.forceDirection == 0)
{
val = Vector3.up;
}
if ((int)move.forceDirection == 1 && Object.op_Implicit((Object)(object)ownRig) && Object.op_Implicit((Object)(object)enemyTorso))
{
val = enemyTorso.position - ownRig.position;
if (move.normalize)
{
val = ((Vector3)(ref val)).normalized;
}
}
if ((int)move.forceDirection == 10 && Object.op_Implicit((Object)(object)ownRig) && Object.op_Implicit((Object)(object)targetData) && Object.op_Implicit((Object)(object)targetData.head))
{
val = targetData.head.position + ((Component)targetData.head).transform.forward * 0.1f + ((Component)targetData.head).transform.up * 0.15f - ownRig.position;
if (move.normalize)
{
val = ((Vector3)(ref val)).normalized;
}
}
if ((int)move.forceDirection == 2)
{
if (Object.op_Implicit((Object)(object)enemyWeapon))
{
val = ownRig.position - (enemyWeapon.worldCenterOfMass + enemyWeapon.velocity * move.predictionAmount);
if (move.normalize)
{
val = ((Vector3)(ref val)).normalized;
}
if (move.ignoreY)
{
((Vector3)(ref val))..ctor(val.x, 0f, val.y);
}
if (Data.cantFallForSeconds < 0.5f)
{
Data.cantFallForSeconds = 0.5f;
}
}
else if (Object.op_Implicit((Object)(object)enemyTorso))
{
val = -(enemyTorso.position - ownRig.position);
if (move.normalize)
{
val = ((Vector3)(ref val)).normalized;
}
}
}
Vector3 val2;
if ((int)move.forceDirection == 3)
{
val = Data.characterForwardObject.forward;
}
else if ((int)move.forceDirection == 4)
{
val = Data.characterForwardObject.right;
}
else if ((int)move.forceDirection == 5 && Object.op_Implicit((Object)(object)ownRig) && Object.op_Implicit((Object)(object)enemyTorso))
{
val = Vector3.Cross(Vector3.up, ownRig.position - enemyTorso.position);
if (move.normalize)
{
val = ((Vector3)(ref val)).normalized;
}
}
else if ((int)move.forceDirection == 6 && Object.op_Implicit((Object)(object)ownRig) && Object.op_Implicit((Object)(object)Data.targetMainRig))
{
val = Vector3.Cross(Vector3.up, ownRig.position - Data.targetMainRig.position);
if (move.normalize)
{
val = ((Vector3)(ref val)).normalized;
}
}
else if ((int)move.forceDirection == 14 && Object.op_Implicit((Object)(object)ownRig))
{
val = ((Component)ownRig).transform.up;
}
else if ((int)move.forceDirection == 15 && Object.op_Implicit((Object)(object)enemyTorso) && Object.op_Implicit((Object)(object)ownRig))
{
Vector3 val3;
if (Object.op_Implicit((Object)(object)Possess) && Object.op_Implicit((Object)(object)Possess.currentUnit) && Object.op_Implicit((Object)(object)Data) && Object.op_Implicit((Object)(object)Data.unit) && (Object)(object)Possess.currentUnit == (Object)(object)Data.unit)
{
val2 = Vector3.Cross(((Component)MainCam.instance).transform.forward, ((Component)ownRig).transform.forward);
val3 = -((Vector3)(ref val2)).normalized * Vector3.Angle(((Component)MainCam.instance).transform.forward, ((Component)ownRig).transform.forward);
}
else
{
val2 = Vector3.Cross(enemyTorso.position - ownRig.position, ((Component)ownRig).transform.forward);
val3 = -((Vector3)(ref val2)).normalized * Vector3.Angle(enemyTorso.position - ownRig.position, ((Component)ownRig).transform.forward);
}
val = val3;
}
else if ((int)move.forceDirection == 7 && Object.op_Implicit((Object)(object)enemyTorso) && Object.op_Implicit((Object)(object)ownRig))
{
val2 = Vector3.Cross(enemyTorso.position - ownRig.position, ((Component)ownRig).transform.forward);
val = -((Vector3)(ref val2)).normalized * Vector3.Angle(enemyTorso.position - ownRig.position, ((Component)ownRig).transform.forward);
}
else if ((int)move.forceDirection == 11 && Object.op_Implicit((Object)(object)targetData) && Object.op_Implicit((Object)(object)targetData.head) && Object.op_Implicit((Object)(object)ownRig))
{
val2 = Vector3.Cross(targetData.head.position + ((Component)targetData.head).transform.forward * 0.1f + ((Component)targetData.head).transform.up * 0.15f - ownRig.position, ((Component)ownRig).transform.forward);
val = -((Vector3)(ref val2)).normalized * Vector3.Angle(targetData.head.position + ((Component)targetData.head).transform.forward * 0.1f + ((Component)targetData.head).transform.up * 0.15f - ownRig.position, ((Component)ownRig).transform.forward);
}
else if ((int)move.forceDirection == 8 && Object.op_Implicit((Object)(object)targetObject) && Object.op_Implicit((Object)(object)ownRig))
{
val = ((Component)ownRig).transform.position - ((Component)targetObject).transform.position;
if (move.normalize)
{
val = ((Vector3)(ref val)).normalized;
}
}
else if ((int)move.forceDirection == 9 && Object.op_Implicit((Object)(object)targetObject) && Object.op_Implicit((Object)(object)ownRig))
{
val = Vector3.Cross(Vector3.up, ownRig.position - targetObject.position);
if (move.normalize)
{
val = ((Vector3)(ref val)).normalized;
}
}
else if ((int)move.forceDirection == 12)
{
val = Data.groundedMovementDirectionObject.forward;
}
else if ((int)move.forceDirection == 13)
{
val2 = Vector3.Cross(((Component)ownRig).transform.forward, Data.groundedMovementDirectionObject.forward);
val = ((Vector3)(ref val2)).normalized * Vector3.Angle(((Component)ownRig).transform.forward, Data.groundedMovementDirectionObject.forward);
}
else if (move.randomizeDirection && Random.value > 0.5f)
{
val *= -1f;
}
else if ((int)move.forceDirection == 16 && Object.op_Implicit((Object)(object)ownRig) && Object.op_Implicit((Object)(object)enemyTorso))
{
((Vector3)(ref val))..ctor(enemyTorso.position.x - ownRig.position.x, 0f, enemyTorso.position.z - ownRig.position.z);
}
return val;
}
public void SetIsRemotelyControlled(bool isRemotelyControlled)
{
IsRemotelyControlled = isRemotelyControlled;
}
private bool IsAllowedToDoMoveInMultiplayer(CombatMoveDataInstance move)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
if (!allowForMartian && IsRemotelyControlled)
{
return (int)move.rigidbodyToMove == 8;
}
return true;
}
}
public class DreadSwords : MonoBehaviour
{
public delegate void AttackedEventHandler(Rigidbody target, int useAttackID);
public UnityEvent shootEvent;
private ShootPosition[] SwordPoints;
private List<SpookySword> Swords = new List<SpookySword>();
public GameObject sourceSword;
public float throwRange = 10f;
public float followSpeed = 1f;
public float throwSpeed = 100f;
public AnimationCurve throwCurve;
private float Counter;
private DataHandler Data;
private bool Done;
public float attackRate;
private float AttackspeedMulti = 1f;
private int AttackID;
public event AttackedEventHandler Attacked;
private void Awake()
{
SwordPoints = ((Component)this).GetComponentsInChildren<ShootPosition>();
}
private void Start()
{
//IL_002e: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
Data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
List<Renderer> list = new List<Renderer>();
for (int i = 0; i < SwordPoints.Length; i++)
{
SpookySword val = CreateNewSword(((Component)SwordPoints[i]).transform.position + Vector3.up * 2f, quaternion.op_Implicit(((Component)SwordPoints[i]).transform.rotation));
Renderer[] componentsInChildren = val.gameObject.GetComponentsInChildren<Renderer>();
if (componentsInChildren != null && componentsInChildren.Length != 0)
{
list.AddRange(componentsInChildren);
}
Swords.Add(val);
}
if ((Object)(object)Data != (Object)null && (Object)(object)Data.unit != (Object)null)
{
Data.unit.AddRenderersToShowHide(list.ToArray(), Data.unit.IsSpawnedInBlindPlacement);
}
for (int j = 0; j < Swords.Count; j++)
{
if (!((Object)(object)Swords[j].gameObject == (Object)null))
{
Swords[j].gameObject.transform.position = ((Component)SwordPoints[j]).transform.position;
Swords[j].gameObject.transform.rotation = ((Component)SwordPoints[j]).transform.rotation;
}
}
}
private void Update()
{
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
if (Done)
{
return;
}
if (Object.op_Implicit((Object)(object)Data) && Data.Dead)
{
Done = true;
for (int i = 0; i < Swords.Count; i++)
{
AttackID = i;
Attack(Data.mainRig, AttackID);
}
}
float num = Mathf.Clamp(Time.deltaTime, 0f, 0.02f);
if (Object.op_Implicit((Object)(object)Data.weaponHandler))
{
AttackspeedMulti = Data.weaponHandler.attackSpeedMultiplier;
}
bool num2 = (Object)(object)Data.unit == (Object)null || !Data.unit.IsRemotelyControlled;
Counter += Time.deltaTime * AttackspeedMulti;
if (num2 && Object.op_Implicit((Object)(object)Data.targetMainRig) && Counter > attackRate)
{
float num3 = 999f;
for (int j = 0; j < SwordPoints.Length; j++)
{
float num4 = Vector3.Angle(Data.targetMainRig.position - ((Component)this).transform.position, ((Component)SwordPoints[j]).gameObject.transform.position - ((Component)this).transform.position);
if (num4 < num3 && Swords[j].sinceSpawn > 1.5f)
{
num3 = num4;
AttackID = j;
}
}
if (Object.op_Implicit((Object)(object)Data.targetMainRig) && Data.distanceToTarget < throwRange)
{
Attack(Data.targetMainRig, AttackID);
}
}
for (int k = 0; k < Swords.Count; k++)
{
if (!((Object)(object)Swords[k].gameObject == (Object)null))
{
SpookySword obj = Swords[k];
obj.sinceSpawn += num;
Swords[k].gameObject.transform.position = ((Component)SwordPoints[k]).transform.position;
Swords[k].gameObject.transform.rotation = ((Component)SwordPoints[k]).transform.rotation;
}
}
}
public void Attack(Rigidbody target, int useAttackID)
{
//IL_007f: 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)
Counter = 0f;
if (useAttackID < 0 || useAttackID >= Swords.Count)
{
useAttackID = Random.Range(0, Swords.Count);
}
SpookySword val = Swords[useAttackID];
if (val != null)
{
((MonoBehaviour)this).StartCoroutine(DoAttack(val, target));
shootEvent.Invoke();
if (!Done)
{
Swords[useAttackID] = CreateNewSword(((Component)SwordPoints[useAttackID]).gameObject.transform.position, quaternion.op_Implicit(((Component)SwordPoints[useAttackID]).gameObject.transform.rotation));
}
else
{
val.gameObject.GetComponent<ProjectileHit>().ignoreTeamMates = false;
}
this.Attacked?.Invoke(target, useAttackID);
}
}
private void OnDestroy()
{
((MonoBehaviour)this).StopAllCoroutines();
for (int i = 0; i < Swords.Count; i++)
{
_ = (Object)(object)Swords[i].gameObject != (Object)null;
Object.Destroy((Object)(object)Swords[i].gameObject);
}
}
private IEnumerator DoAttack(SpookySword attackSword, Rigidbody targ)
{
if (!Object.op_Implicit((Object)(object)attackSword.gameObject))
{
yield break;
}
float counter3 = 0f;
float t = ((Keyframe)(ref throwCurve.keys[throwCurve.keys.Length - 1])).time;
ProjectileStick stick = attackSword.gameObject.GetComponent<ProjectileStick>();
((Behaviour)attackSword.gameObject.GetComponent<RaycastTrail>()).enabled = true;
while (counter3 < t && (!Object.op_Implicit((Object)(object)stick) || !stick.stuck))
{
if ((Object)(object)attackSword.gameObject == (Object)null || (Object)(object)targ == (Object)null)
{
yield break;
}
float num = Mathf.Clamp(Time.deltaTime, 0f, 0.02f);
counter3 += Time.deltaTime;
MoveTransform move = attackSword.move;
Vector3 velocity = attackSword.move.velocity;
Vector3 val = targ.position - attackSword.gameObject.transform.position;
move.velocity = Vector3.Lerp(velocity, ((Vector3)(ref val)).normalized * throwSpeed * throwCurve.Evaluate(counter3), num * 8f);
attackSword.gameObject.transform.rotation = Quaternion.Lerp(attackSword.gameObject.transform.rotation, quaternion.op_Implicit(quaternion.LookRotation(float3.op_Implicit(targ.position - attackSword.gameObject.transform.position), float3.op_Implicit(Vector3.up))), num * 7f);
yield return null;
}
counter3 = 0f;
while (counter3 < 0.5f && (!Object.op_Implicit((Object)(object)stick) || !stick.stuck))
{
float num2 = Mathf.Clamp(Time.deltaTime, 0f, 0.02f);
counter3 += Time.deltaTime;
if ((Object)(object)attackSword.gameObject != (Object)null)
{
attackSword.gameObject.transform.rotation = Quaternion.Lerp(attackSword.gameObject.transform.rotation, quaternion.op_Implicit(quaternion.LookRotation(float3.op_Implicit(attackSword.move.velocity), float3.op_Implicit(Vector3.up))), num2 * 15f);
}
yield return null;
}
}
private SpookySword CreateNewSword(Vector3 pos, quaternion rot)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
SpookySword val = new SpookySword
{
gameObject = Object.Instantiate<GameObject>(sourceSword, pos, quaternion.op_Implicit(rot))
};
val.move = val.gameObject.GetComponent<MoveTransform>();
GameObjectExtensions.FetchComponent<TeamHolder>(val.gameObject).team = Data.team;
val.gameObject.GetComponentInChildren<CodeAnimation>().speedMultiplier = AttackspeedMulti;
return val;
}
}
public class HadezHands : MonoBehaviour
{
public string swingRef;
public string hitRef;
private Transform TargetTrans;
private List<AttackArm> AttackArms = new List<AttackArm>();
public AnimationCurve reachCurve;
public AnimationCurve goBackToHoldCurve;
public AnimationCurve goBackToHoldCurveFollowMainRigAmount;
public AnimationCurve throwCurve;
private float FollowMainRigAmount;
private Unit Unit;
private float SnapSpeed;
private List<Unit> HitList = new List<Unit>();
public void Start()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_006b: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < ((Component)this).transform.childCount; i++)
{
AttackArm val = new AttackArm();
val.targetObj = ((Component)((Component)this).transform.GetChild(i).Find("Target")).gameObject;
val.restPosObj = ((Component)((Component)this).transform.GetChild(i).Find("RestPos")).gameObject;
val.lerpSpeed = Random.Range(0.5f, 1.5f);
val.smoothTargetPos = ((Component)this).transform.position;
val.targetPos = ((Component)this).transform.position;
AttackArms.Add(val);
}
Unit = ((Component)this).GetComponentInParent<Weapon>().connectedData.unit;
TargetTrans = ((Component)this).transform.parent;
((Component)this).transform.SetParent(((Component)Unit).transform);
}
private void Update()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)TargetTrans == (Object)null || Unit.data.Dead)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
return;
}
((Component)this).transform.position = TargetTrans.position;
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, TargetTrans.rotation, Time.deltaTime * 2.5f);
for (int i = 0; i < AttackArms.Count; i++)
{
AttackArm obj = AttackArms[i];
obj.counter += Time.deltaTime;
Vector3 val = Vector3.Lerp(AttackArms[i].smoothTargetPos, AttackArms[i].targetPos, Time.deltaTime * 10f);
if ((int)AttackArms[i].armState == 0)
{
AttackArms[i].targetPos = Vector3.Lerp(AttackArms[i].targetPos, AttackArms[i].restPosObj.transform.position + GetPerlinPos(AttackArms[i].lerpSpeed) * 2f, Time.deltaTime * 3f * AttackArms[i].lerpSpeed);
AttackArms[i].smoothTargetPos = val;
SnapSpeed = 0f;
}
else
{
SnapSpeed += Time.deltaTime;
AttackArms[i].smoothTargetPos = Vector3.Lerp(val, AttackArms[i].targetPos, SnapSpeed);
}
if (Object.op_Implicit((Object)(object)AttackArms[i].heldUnit))
{
AttackArms[i].targetObj.transform.position = Vector3.Lerp(AttackArms[i].smoothTargetPos, AttackArms[i].heldUnit.data.mainRig.position, FollowMainRigAmount);
}
else
{
AttackArms[i].targetObj.transform.position = AttackArms[i].smoothTargetPos;
}
}
CheckAttack(AttackArms[Random.Range(0, AttackArms.Count)]);
}
private void CheckAttack(AttackArm attack)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
Unit val = SetTarget();
if (attack.counter > 3f && Unit.data.distanceToTarget <= 10f && (int)attack.armState == 0 && (Object)(object)val != (Object)null)
{
HitList.Add(val);
attack.counter = 0f;
((MonoBehaviour)this).StartCoroutine(Attack(attack, val));
}
}
private IEnumerator Attack(AttackArm attack, Unit targetUnit)
{
attack.armState = (ArmState)1;
attack.heldUnit = targetUnit;
float c3 = 0f;
if (swingRef != "")
{
ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect(swingRef, 1f, ((Component)this).transform.position, (MaterialType)0, (Transform)null, 1f);
}
while (c3 < 3f && Object.op_Implicit((Object)(object)targetUnit) && Object.op_Implicit((Object)(object)targetUnit.data.mainRig) && !targetUnit.data.Dead)
{
Vector3 val = targetUnit.data.mainRig.position - attack.restPosObj.transform.position;
attack.targetPos = attack.restPosObj.transform.position + val * reachCurve.Evaluate(c3);
((Damagable)targetUnit.data.healthHandler).TakeDamage(100f * Time.deltaTime, Vector3.up, (Unit)null, (DamageType)0);
c3 += Time.deltaTime * Time.timeScale;
yield return null;
}
attack.armState = (ArmState)0;
c3 = 0f;
float t2 = AnimationCurveFunctions.GetAnimLength(goBackToHoldCurve);
while (c3 < t2 && Object.op_Implicit((Object)(object)targetUnit) && Object.op_Implicit((Object)(object)targetUnit.data.mainRig))
{
Vector3 val2 = targetUnit.data.mainRig.position - attack.restPosObj.transform.position;
attack.targetPos = attack.restPosObj.transform.position + val2 * goBackToHoldCurve.Evaluate(c3);
c3 += Time.deltaTime;
FollowMainRigAmount = goBackToHoldCurveFollowMainRigAmount.Evaluate(c3);
yield return null;
}
HitList.Remove(attack.heldUnit);
attack.heldUnit = null;
}
private Vector3 GetPerlinPos(float input)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
input *= 0.2f;
Vector3 result = default(Vector3);
((Vector3)(ref result))..ctor(0f, 0f, 0f);
result.x += Mathf.PerlinNoise(Time.time * input, 0f);
result.y += Mathf.PerlinNoise(Time.time * input, Time.time * input);
result.z += Mathf.PerlinNoise(0f, Time.time * input);
result.x -= 0.5f;
result.y -= 0.5f;
result.z -= 0.5f;
return result;
}
public Unit SetTarget()
{
Unit[] array = Object.FindObjectsOfType<Unit>().Cast<Unit>().Where(delegate(Unit unit)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
if (!unit.data.Dead && unit.Team != ((Component)((Component)this).transform.root).GetComponent<Unit>().Team && !HitList.Contains(unit))
{
Vector3 val2 = ((Component)unit.data.mainRig).transform.position - ((Component)this).transform.position;
return ((Vector3)(ref val2)).magnitude <= 10f;
}
return false;
})
.OrderBy(delegate(Unit unit)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)unit.data.mainRig).transform.position - ((Component)this).transform.position;
return ((Vector3)(ref val)).magnitude;
})
.ToArray();
if (array.Length != 0)
{
return array[0];
}
return null;
}
}
public class Laser : MonoBehaviour
{
private LineRenderer Line;
[Header("Line Settings")]
public GameObject p1;
public GameObject p2;
public float maxDistance = 10f;
[Header("Animation")]
public float scaleMultiplier = 1f;
[Header("Hit")]
public UnityEvent hitEvent = new UnityEvent();
public LayerMask layer;
public void Awake()
{
Line = ((Component)this).GetComponent<LineRenderer>();
}
public void Activate()
{
((MonoBehaviour)this).StartCoroutine(Animate(activating: true));
}
public void Deactivate()
{
((MonoBehaviour)this).StartCoroutine(Animate(activating: false));
}
public IEnumerator Animate(bool activating)
{
float t = 0f;
while (t < 1f)
{
t += Time.deltaTime;
Line.widthMultiplier = Mathf.Lerp(activating ? 0f : scaleMultiplier, activating ? scaleMultiplier : 0f, Mathf.Clamp(t, 0f, 1f));
yield return null;
}
}
public void Update()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: 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_0087: Unknown result type (might be due to invalid IL or missing references)
Line.SetPosition(0, p2.transform.position);
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(p2.transform.position, p2.transform.forward, ref val, maxDistance, LayerMask.op_Implicit(layer)))
{
if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider))
{
Line.SetPosition(1, ((RaycastHit)(ref val)).point);
p1.transform.position = ((RaycastHit)(ref val)).point;
hitEvent.Invoke();
}
}
else
{
Line.SetPosition(1, p2.transform.forward * maxDistance);
p1.transform.position = p2.transform.forward * maxDistance;
}
}
}
public class PhoenixWings : MonoBehaviour
{
public LayerMask mask;
public AnimationCurve flightCurve;
public float heightVariance = 0.5f;
public float variationSpeed = 0.5f;
public float flightForce;
public float legForceMultiplier = 1f;
private DataHandler Data;
private RigidbodyHolder RigHolder;
private Rigidbody RightFootRig;
private Rigidbody LeftFootRig;
private Rigidbody HipRig;
private Rigidbody HeadRig;
public float headM = 0.5f;
private float Time;
public bool useWings = true;
public bool useWingsInPlacement = true;
[Tooltip("Enable if units move erratically on the client side of ProjectMars games. Only enable if you are sure Wings.cs is causing erratic movement.")]
public bool setUnitMainRigKinematic;
private GameStateManager MGameStateManager;
public float rotationTorque = 10f;
private void Start()
{
Data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
RigHolder = ((Component)Data).GetComponent<RigidbodyHolder>();
Data.takeFallDamage = false;
Data.canFall = false;
if (Object.op_Implicit((Object)(object)Data.footRight))
{
RightFootRig = ((Component)Data.footRight).GetComponent<Rigidbody>();
}
if (Object.op_Implicit((Object)(object)Data.footLeft))
{
LeftFootRig = ((Component)Data.footLeft).GetComponent<Rigidbody>();
}
HipRig = ((Component)Data.hip).GetComponent<Rigidbody>();
if (Object.op_Implicit((Object)(object)Data.head))
{
HeadRig = ((Component)Data.head).GetComponent<Rigidbody>();
}
AnimationHandler component = ((Component)Data).GetComponent<AnimationHandler>();
if (Object.op_Implicit((Object)(object)component))
{
component.multiplier = 0.5f;
}
heightVariance *= Random.value;
Time = Random.Range(0f, 1000f);
Balance component2 = ((Component)Data).GetComponent<Balance>();
if (Object.op_Implicit((Object)(object)component2))
{
((Behaviour)component2).enabled = false;
}
MGameStateManager = ServiceLocator.GetService<GameStateManager>();
if (setUnitMainRigKinematic && BoltNetwork.IsClient)
{
Data.mainRig.isKinematic = true;
}
}
private void FixedUpdate()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Invalid comparison between Unknown and I4
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: 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_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
if ((!useWingsInPlacement && (int)MGameStateManager.GameState != 1) || !useWings)
{
return;
}
_ = Data.unit.m_PreferedDistance;
_ = Data.distanceToTarget;
RaycastHit val = default(RaycastHit);
Physics.Raycast(new Ray(((Component)this).transform.position, Vector3.down), ref val, ((Keyframe)(ref flightCurve.keys[flightCurve.keys.Length - 1])).time, LayerMask.op_Implicit(mask));
if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).transform))
{
float num = ((RaycastHit)(ref val)).distance + Mathf.Cos((Time.time + Time) * variationSpeed) * heightVariance;
Data.mainRig.AddTorque(rotationTorque * Vector3.Angle(((Component)Data.mainRig).transform.up, Data.groundedMovementDirectionObject.forward) * Vector3.Cross(((Component)Data.mainRig).transform.up, Data.groundedMovementDirectionObject.forward), (ForceMode)5);
if (Object.op_Implicit((Object)(object)HeadRig))
{
HeadRig.AddForce(Vector3.up * flightForce * headM * flightCurve.Evaluate(num), (ForceMode)5);
}
Data.mainRig.AddForce(Vector3.up * flightForce * flightCurve.Evaluate(num), (ForceMode)5);
if (Object.op_Implicit((Object)(object)RightFootRig))
{
RightFootRig.AddForce(Vector3.up * flightForce * legForceMultiplier * 0.5f * flightCurve.Evaluate(num), (ForceMode)5);
}
if (Object.op_Implicit((Object)(object)RightFootRig))
{
LeftFootRig.AddForce(Vector3.up * flightForce * legForceMultiplier * 0.5f * flightCurve.Evaluate(num), (ForceMode)5);
}
Data.TouchGround(((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal, (Rigidbody)null);
}
}
public void EnableFlight()
{
useWings = true;
}
public void DiableFlight()
{
useWings = false;
}
}
public class SpawnWall : MonoBehaviour, IRemotelyControllable
{
public GameObject objectToSpawn;
public float percentage = 0.5f;
public bool spawnOnAwake;
public int numberToSpawn = 1;
public bool spawnIfUnitDead = true;
public bool parentToMe;
public bool followMe;
public bool useRootSizeOfSpawner;
public bool giveTarget;
public bool allowRootTarget;
public bool useAlternatingSpawnPos;
public bool giveSpawnerWeapon;
public float spread;
public float timeBetweenSpawns = 0.02f;
public bool waitBeforeFirstSpawn;
public bool useRandom;
public float minRandom = 1f;
public float maxRandom = 1f;
public float maxRange;
private bool DidInitialize;
public UnityEvent spawnEvent;
private ProjectilesSpawnManager ProjectilesSpawnManager;
private bool IsProjectile;
private GameObject RootObject;
private DataHandler Data;
private CheckClosestUnitTargets TargetChecker;
private float AllowedToSpawn = 1f;
private float SpawnedSinceDelay;
private List<Unit> Targets;
private Unit CurrentTarget;
private List<AlternatingSpawnPos> AltSpawnPos;
private int TargetPlace;
private int CurrentSpawnPosNumber;
[HideInInspector]
public GameObject spawnerProjecile;
private bool DidInitializeForMultiplayer;
private bool IsUnit;
public bool IsRemotelyControlled { get; private set; }
private void Start()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
Data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
RootObject = ((Component)((Component)this).transform.root).gameObject;
if (giveTarget)
{
TargetChecker = ((Component)this).GetComponent<CheckClosestUnitTargets>();
}
if (spawnOnAwake)
{
((MonoBehaviour)this).StartCoroutine(SpawnUnit(((Component)this).transform.position, ((Component)this).transform.rotation));
}
}
public void SpawnUpwardsOnLastGroundPos()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Data))
{
((MonoBehaviour)this).StartCoroutine(SpawnUnit(Data.groundMapPosition, Quaternion.LookRotation(Vector3.up)));
}
else
{
SpawnUpwards();
}
}
public void SpawnUpwardsOnTarget()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: 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)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = ((Component)this).transform.position;
if (!Object.op_Implicit((Object)(object)Data))
{
Data = RootObject.GetComponent<Unit>().data;
}
if (Object.op_Implicit((Object)(object)Data) && Object.op_Implicit((Object)(object)Data.targetData))
{
position = Data.targetData.mainRig.position;
if (maxRange != 0f && Data.distanceToTarget > maxRange)
{
return;
}
}
((MonoBehaviour)this).StartCoroutine(SpawnUnit(position, Quaternion.LookRotation(Vector3.up + Random.insideUnitSphere * spread * 0.01f)));
}
public void SpawnOnAndTowardsTarget()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_010f: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = ((Component)this).transform.position;
if (!Object.op_Implicit((Object)(object)Data))
{
Data = RootObject.GetComponent<Unit>().data;
}
if (Object.op_Implicit((Object)(object)Data) && Object.op_Implicit((Object)(object)Data.targetData))
{
position = Data.targetData.mainRig.position;
if (maxRange != 0f && Data.distanceToTarget > maxRange)
{
return;
}
}
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(Data.targetData.mainRig.position.x - Data.mainRig.position.x, 0f, Data.targetData.mainRig.position.z - Data.mainRig.position.z);
((MonoBehaviour)this).StartCoroutine(SpawnUnit(position, Quaternion.LookRotation(val + Random.insideUnitSphere * spread * 0.01f)));
}
public void SpawnUpwardsOnSpawnerTarget()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = ((Component)this).transform.position;
DataHandler val = null;
TeamHolder component = ((Component)((Component)this).transform.root).GetComponent<TeamHolder>();
if (Object.op_Implicit((Object)(object)component.spawner))
{
val = ((Component)component.spawner.transform.root).GetComponent<Unit>().data;
}
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.targetData))
{
position = val.targetData.mainRig.position;
if (maxRange != 0f && val.distanceToTarget > maxRange)
{
return;
}
}
((MonoBehaviour)this).StartCoroutine(SpawnUnit(position, Quaternion.LookRotation(Vector3.up + Random.insideUnitSphere * spread * 0.01f)));
}
public void SpawnUpwards()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
((MonoBehaviour)this).StartCoroutine(SpawnUnit(((Component)this).transform.position, Quaternion.LookRotation(Vector3.up + Random.insideUnitSphere * spread * 0.01f)));
}
public void SpawnAtObjectRotation()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)this).transform.rotation * Vector3.forward;
((MonoBehaviour)this).StartCoroutine(SpawnUnit(((Component)this).transform.position, Quaternion.LookRotation(val + Random.insideUnitSphere * spread * 0.01f)));
}
public void SpawnTowardsTarget()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_0074: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)Data))
{
Data = RootObject.GetComponent<Unit>().data;
}
if (Object.op_Implicit((Object)(object)Data.targetData))
{
Vector3 position = ((Component)this).transform.position;
Vector3 val = Data.targetData.mainRig.position - Data.mainRig.position;
((MonoBehaviour)this).StartCoroutine(SpawnUnit(position, Quaternion.LookRotation(((Vector3)(ref val)).normalized + Random.insideUnitSphere * spread * 0.01f)));
}
}
public void SpawnTowardsTargetWithoutY()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)Data))
{
Data = RootObject.GetComponent<Unit>().data;
}
if (Object.op_Implicit((Object)(object)Data.targetData))
{
Vector3 val = new Vector3(Data.targetData.mainRig.position.x - Data.mainRig.position.x, 0f, Data.targetData.mainRig.position.z - Data.mainRig.position.z);
((MonoBehaviour)this).StartCoroutine(SpawnUnit(rotation: Quaternion.LookRotation(((Vector3)(ref val)).normalized + Random.insideUnitSphere * spread * 0.01f), position: Vector3.Lerp(Data.targetData.mainRig.position, ((Component)this).transform.position, percentage)));
}
}
public void SpawnCharacterForward()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
((MonoBehaviour)this).StartCoroutine(SpawnUnit(((Component)this).transform.position, Quaternion.LookRotation(((Component)((Component)((Component)this).transform.root).GetComponent<Unit>().data.mainRig).transform.forward + Random.insideUnitSphere * spread * 0.01f)));
}
public void Spawn(Vector3 position, Vector3 direction)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
((MonoBehaviour)this).StartCoroutine(SpawnUnit(position, Quaternion.LookRotation(direction + Random.insideUnitSphere * spread * 0.01f)));
}
private IEnumerator SpawnUnit(Vector3 position, Quaternion rotation)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//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.op_Implicit((Object)(object)TargetChecker))
{
Targets = new List<Unit>();
Targets = TargetChecker.GetTargets((float?)maxRange);
}
if (waitBeforeFirstSpawn)
{
SpawnedSinceDelay = AllowedToSpawn;
}
int numberSpawned = 0;
while (numberSpawned < numberToSpawn)
{
InitializeSpawn();
if (!IsAllowedToSpawnInMultiplayer())
{
yield return null;
}
if (Object.op_Implicit((Object)(object)Data) && Data.Dead && !spawnIfUnitDead)
{
yield return null;
}
if (useAlternatingSpawnPos)
{
AltSpawnPos = new List<AlternatingSpawnPos>();
AltSpawnPos.AddRange(((Component)((Component)this).transform.parent).GetComponentsInChildren<AlternatingSpawnPos>());
}
if (SpawnedSinceDelay < AllowedToSpawn)
{
if (useAlternatingSpawnPos && AltSpawnPos.Count > 0)
{
if (CurrentSpawnPosNumber > AltSpawnPos.Count - 1)
{
CurrentSpawnPosNumber = 0;
}
position = ((Component)AltSpawnPos[CurrentSpawnPosNumber]).transform.position;
if (numberToSpawn - numberSpawned <= AltSpawnPos.Count && AltSpawnPos[CurrentSpawnPosNumber].useLastSpawnEvent)
{
AltSpawnPos[CurrentSpawnPosNumber].InvokeLastSpawnEvent();
}
else
{
AltSpawnPos[CurrentSpawnPosNumber].InvokeSpawnEvent();
}
}
GameObject val = ((!IsProjectile || !((Object)(object)ProjectilesSpawnManager != (Object)null)) ? Object.Instantiate<GameObject>(objectToSpawn, position, rotation) : ProjectilesSpawnManager.SpawnProjectile(objectToSpawn, position, rotation));
TeamHolder.AddTeamHolder(val, ((Component)((Component)this).transform).gameObject);
TeamHolder component = val.GetComponent<TeamHolder>();
if (giveSpawnerWeapon)
{
component.spawnerWeapon = ((Component)((Component)((Component)this).transform).GetComponentInParent<Weapon>()).gameObject;
}
SpawnedSinceDelay += 1f;
if (parentToMe)
{
val.transform.SetParent(((Component)this).transform, true);
}
if (followMe)
{
FollowTransform obj = val.gameObject.AddComponent<FollowTransform>();
obj.target = ((Component)this).transform;
obj.destroyOnTargetNull = false;
}
if (useRootSizeOfSpawner)
{
val.transform.localScale = ((Component)this).transform.root.localScale;
}
SpellTarget component2 = val.GetComponent<SpellTarget>();
if (Object.op_Implicit((Object)(object)TargetChecker) && Targets.Count > 0)
{
if (numberSpawned < Targets.Count)
{
TargetPlace = numberSpawned;
}
else
{
TargetPlace = numberSpawned - Targets.Count * Mathf.FloorToInt((float)(numberSpawned / Targets.Count));
}
}
if (Object.op_Implicit((Object)(object)component2))
{
if (Object.op_Implicit((Object)(object)TargetChecker) && giveTarget && TargetPlace < Targets.Count)
{
CurrentTarget = Targets[TargetPlace];
DataHandler componentInChildren = ((Component)CurrentTarget).GetComponentInChildren<DataHandler>();
Vector3 position2 = ((Component)this).transform.position;
Vector3 position3 = componentInChildren.mainRig.position;
Rigidbody mainRig = componentInChildren.mainRig;
((TargetableEffect)component2).DoEffect(position2, position3, mainRig);
}
else
{
component2.GetTarget();
}
}
TeslaCannon component3 = val.GetComponent<TeslaCannon>();
if (Object.op_Implicit((Object)(object)component3) && Object.op_Implicit((Object)(object)spawnerProjecile))
{
component3.maxTargetChecker = ((Component)spawnerProjecile.transform).GetComponent<TeslaCannon>().maxTargetChecker;
if (Object.op_Implicit((Object)(object)TargetChecker) && giveTarget && Object.op_Implicit((Object)(object)component3.maxTargetChecker) && component3.maxTargetChecker.CheckIfAllowedToHit())
{
Unit component4 = ((Component)((Component)this).transform.root).GetComponent<Unit>();
if (Targets.Count > 0)
{
if (!allowRootTarget && Object.op_Implicit((Object)(object)component4) && (Object)(object)Targets[TargetPlace] == (Object)(object)component4)
{
Targets.Remove(Targets[TargetPlace]);
}
CurrentTarget = Targets[TargetPlace];
DataHandler componentInChildren2 = ((Component)CurrentTarget).GetComponentInChildren<DataHandler>();
TeamHolder component5 = ((Component)this).GetComponent<TeamHolder>();
component.team = component5.team;
component.spawner = component5.spawner;
component3.PlayEffect(((Component)componentInChildren2.mainRig).transform, ((Component)this).transform, component5.spawner);
}
else
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
else
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
numberSpawned++;
CurrentSpawnPosNumber++;
UnityEvent obj2 = spawnEvent;
if (obj2 != null)
{
obj2.Invoke();
}
}
else
{
SpawnedSinceDelay = 0f;
float num = ((!useRandom) ? timeBetweenSpawns : Random.Range(timeBetweenSpawns * minRandom, timeBetweenSpawns * maxRandom));
yield return (object)new WaitForSeconds(num);
}
}
TargetPlace = 0;
}
private void InitializeSpawn()
{
if (!DidInitialize)
{
DidInitialize = true;
if ((Object)(object)objectToSpawn != (Object)null && (Object)(object)objectToSpawn.GetComponent<Projectile>() != (Object)null)
{
IsProjectile = true;
ProjectilesSpawnManager = ServiceLocator.GetService<ProjectilesSpawnManager>();
}
}
}
public void SetIsRemotelyControlled(bool isRemotelyControlled)
{
IsRemotelyControlled = isRemotelyControlled;
}
private bool IsAllowedToSpawnInMultiplayer()
{
InitializeForMultiplayer();
if (!IsUnit && !IsProjectile)
{
return true;
}
return !IsRemotelyControlled;
}
private void InitializeForMultiplayer()
{
if (!DidInitializeForMultiplayer)
{
DidInitializeForMultiplayer = true;
if (BoltNetwork.IsRunning && (Object)(object)objectToSpawn != (Object)null)
{
IsUnit = (Object)(object)objectToSpawn.GetComponent<Unit>() != (Object)null;
}
}
}
}
public class ThorBehavior : MonoBehaviour
{
private Unit Unit;
private bool HoldingRight;
private bool HoldingLeft;
public GameObject weaponToGrab;
public UnityEvent grabEvent = new UnityEvent();
public UnityEvent ungrabEvent = new UnityEvent();
private void Start()
{
Unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
}
public void GrabHammerRight()
{
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Expected O, but got Unknown
if (HoldingRight)
{
return;
}
HoldingRight = true;
grabEvent.Invoke();
Collider[] componentsInChildren = ((Component)((Component)Unit).GetComponentInChildren<HandRight>()).GetComponentsInChildren<Collider>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].enabled = false;
}
if (Object.op_Implicit((Object)(object)Unit.holdingHandler))
{
Unit.WeaponHandler.fistRefernce = null;
if (Object.op_Implicit((Object)(object)Unit.holdingHandler.rightObject))
{
GameObject gameObject = ((Component)Unit.holdingHandler.rightObject).gameObject;
Unit.holdingHandler.LetGoOfWeapon(gameObject);
Object.Destroy((Object)(object)gameObject);
}
SetWeapon(Unit, Unit.Team, weaponToGrab, new PropItemData(), (HandType)0, Unit.data.mainRig.rotation, new List<GameObject>());
}
else
{
if (!Object.op_Implicit((Object)(object)((Component)Unit).GetComponentInChildren<HoldingHandlerMulti>()))
{
return;
}
HoldingHandlerMulti componentInChildren = ((Component)Unit).GetComponentInChildren<HoldingHandlerMulti>();
foreach (HandRight mainHand in componentInChildren.mainHands)
{
componentInChildren.SetWeapon(((Component)mainHand).gameObject, weaponToGrab);
}
}
}
public void GrabHammerLeft()
{
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
if (HoldingLeft)
{
return;
}
HoldingLeft = true;
Collider[] componentsInChildren = ((Component)((Component)Unit).GetComponentInChildren<HandLeft>()).GetComponentsInChildren<Collider>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].enabled = false;
}
if (Object.op_Implicit((Object)(object)Unit.holdingHandler))
{
weaponToGrab.GetComponent<Holdable>().holdableData.snapConnect = false;
if (Object.op_Implicit((Object)(object)Unit.holdingHandler.leftObject))
{
GameObject gameObject = ((Component)Unit.holdingHandler.leftObject).gameObject;
Unit.holdingHandler.LetGoOfWeapon(gameObject);
Object.Destroy((Object)(object)gameObject);
}
Unit.holdingHandler.leftHandActivity = (HandActivity)1;
}
else
{
if (!Object.op_Implicit((Object)(object)((Component)Unit).GetComponentInChildren<HoldingHandlerMulti>()))
{
return;
}
HoldingHandlerMulti componentInChildren = ((Component)Unit).GetComponentInChildren<HoldingHandlerMulti>();
foreach (HandLeft otherHand in componentInChildren.otherHands)
{
componentInChildren.SetWeapon(((Component)otherHand).gameObject, weaponToGrab);
}
}
}
public void UnGrabHammer()
{
if (HoldingLeft || HoldingRight)
{
HoldingLeft = false;
HoldingRight = false;
ungrabEvent.Invoke();
if (Object.op_Implicit((Object)(object)Unit.holdingHandler))
{
Unit.holdingHandler.LetGoOfWeapon(weaponToGrab);
}
else if (Object.op_Implicit((Object)(object)((Component)Unit).GetComponentInChildren<HoldingHandlerMulti>()))
{
((Component)Unit).GetComponentInChildren<HoldingHandlerMulti>().LetGoOfAll(false);
}
}
}
public Weapon SetWeapon(Unit unit, Team team, GameObject weaponObject, PropItemData weaponData, HandType handType, Quaternion rotation, List<GameObject> objects, bool isUnitEditor = false)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: 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)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
WeaponHandler componentInChildren = ((Component)unit).GetComponentInChildren<WeaponHandler>();
if (!Object.op_Implicit((Object)(object)componentInChildren))
{
MultipleWeaponHandler componentInChildren2 = ((Component)unit).GetComponentInChildren<MultipleWeaponHandler>();
if (Object.op_Implicit((Object)(object)componentInChildren2))
{
componentInChildren2.SetWeapon(weaponObject, handType, false);
}
return null;
}
Torso componentInChildren3 = ((Component)unit).GetComponentInChildren<Torso>();
if (Object.op_Implicit((Object)(object)weaponObject))
{
weaponObject.transform.position = ((Component)componentInChildren3).transform.position + ((Component)componentInChildren3).transform.forward * 0.5f;
weaponObject.transform.rotation = rotation;
weaponObject.gameObject.transform.SetParent(((Component)unit).transform);
objects.Add(weaponObject);
Weapon component = weaponObject.GetComponent<Weapon>();
WeaponItem component2 = weaponObject.GetComponent<WeaponItem>();
Holdable component3 = weaponObject.GetComponent<Holdable>();
weaponObject.GetComponent<MeleeWeapon>();
RangeWeapon component4 = weaponObject.GetComponent<RangeWeapon>();
if (unit.unitBlueprint.removeCloseRangeMiss && Object.op_Implicit((Object)(object)component4))
{
component4.extraCDInMelee = 0f;
component4.extraSpreadInMelee = 0f;
}
if (Object.op_Implicit((Object)(object)component3))
{
if (component3.useAlternaticeForIceGiant && Object.op_Implicit((Object)(object)((Component)unit).GetComponent<IceGiant>()))
{
component3.holdableData.relativePosition = component3.iceGiantRelativePosition;
}
if ((int)handType == 0)
{
unit.holdingHandler.rightHandActivity = (HandActivity)1;
if (unit.unitBlueprint.holdinigWithTwoHands)
{
unit.holdingHandler.leftHandActivity = (HandActivity)1;
}
unit.holdingHandler.rightObject = component3;
}
else
{
unit.holdingHandler.leftHandActivity = (HandActivity)2;
unit.holdingHandler.leftObject = component3;
component3.holdableData.relativePosition.x += unit.unitBlueprint.weaponSeparation;
component3.holdableData.relativePosition.x *= -1f;
component3.holdableData.upRotation.x *= -1f;
component3.holdableData.forwardRotation.x *= -1f;
}
component3.holdingHandler = unit.holdingHandler;
}
else
{
Transform val = (((int)handType != 0) ? ((Component)((Component)unit).GetComponentInChildren<HandLeft>()).transform : ((Component)((Component)unit).GetComponentInChildren<HandRight>()).transform);
weaponObject.transform.position = val.position;
weaponObject.transform.rotation = val.rotation;
weaponObject.transform.parent = val;
}
componentInChildren.SetWeapon(component, handType);
component2.Initialize(team);
if (weaponData != null)
{
((CharacterItem)component2).SetPropData(weaponData, team);
}
return component;
}
return null;
}
}
namespace Landfall.TABS.AI.Systems.Modifiers
{
[UpdateAfter(typeof(UpdateBarrier))]
[UpdateBefore(typeof(PreLateUpdateBarrier))]
public class CircleTargetSystem : JobComponentSystem
{
private struct Filter
{
public EntityArray Entities;
public ComponentDataArray<Direction> Directions;
[ReadOnly]
public ComponentDataArray<CircleTarget> CircleTargets;
[ReadOnly]
public ComponentDataArray<HasTargetTag> HasTargetTags;
[ReadOnly]
public ComponentDataArray<TargetData> TargetDatas;
[ReadOnly]
public SubtractiveComponent<IsInPool> IsInPool;
public readonly int Length;
}
private struct Job : IJobParallelFor
{
public EntityArray Entities;
public ComponentDataArray<Direction> Directions;
[ReadOnly]
public ComponentDataArray<CircleTarget> CircleTargets;
[ReadOnly]
public ComponentDataArray<HasTargetTag> HasTargetTags;
[ReadOnly]
public ComponentDataArray<TargetData> TargetDatas;
[ReadOnly]
public SubtractiveComponent<IsInPool> IsInPool;
public Concurrent CommandBuffer;
public void Execute(int index)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_006f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
if (!(HasTargetTags[index].Target == Entity.Null))
{
Entity val = ((EntityArray)(ref Entities))[index];
Direction val2 = Directions[index];
CircleTarget circleTarget = CircleTargets[index];
float distanceToTarget = TargetDatas[index].DistanceToTarget;
if (distanceToTarget <= circleTarget.maxCircleDistance && distanceToTarget >= circleTarget.minCircleDistance)
{
float3 value = val2.Value;
float3 val3 = new float3(value.x, 0f, value.z);
float3 val4 = math.cross(math.normalize(val3), new float3(0f, 1f, 0f));
float3 val5 = math.length(val3) * val4;
val2.Value = new float3(val5.x, value.y, val5.z);
}
((Concurrent)(ref CommandBuffer)).SetComponent<Direction>(index, val, val2);
}
}
}
[Inject]
private Filter m_filter;
[Inject]
private PreLateUpdateBarrier m_barrier;
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
Job job = default(Job);
job.Entities = m_filter.Entities;
job.Directions = m_filter.Directions;
job.CircleTargets = m_filter.CircleTargets;
job.TargetDatas = m_filter.TargetDatas;
job.HasTargetTags = m_filter.HasTargetTags;
EntityCommandBuffer val = ((BarrierSystem)m_barrier).CreateCommandBuffer();
job.CommandBuffer = ((EntityCommandBuffer)(ref val)).ToConcurrent();
return IJobParallelForExtensions.Schedule<Job>(job, m_filter.Length, 12, inputDeps);
}
}
}
namespace Landfall.TABS.AI.Components.Modifiers
{
public struct CircleTarget : IMovementComponent, IComponentData
{
public float minCircleDistance;
public float maxCircleDistance;
}
}
namespace HiddenUnits
{
public class AchillesArmor : MonoBehaviour
{
public class UnitIsArmored : MonoBehaviour
{
public bool armorActive = true;
public GameObject projectileHitEffect;
public GameObject weaponHitEffect;
public float parryForce;
public float parryPower;
public float blockPower;
}
private Unit Unit;
private UnitIsArmored ArmoredUnit;
private AchillesArmorEvent[] ArmorListeners;
private bool ArmorDisabled;
private float ArmorDisabledCounter;
private float MaxArmorHealth;
[Header("Armor Settings")]
public UnityEvent armorDisableEvent = new UnityEvent();
public UnityEvent armorEnableEvent = new UnityEvent();
public float armorDisabledTime = 3f;
[Header("Hit Settings")]
public GameObject projectileHitEffect;
public GameObject weaponHitEffect;
public float parryForce;
public float parryPower;
public float blockPower;
[Header("Health Settings")]
public float armorHealth = 500f;
public bool armorRegenerate;
public float armorRegenerationRate = 5f;
public bool healthRegenerate;
public float healthRegenerationRate = 50f;
public void Start()
{
Unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
Unit unit = Unit;
unit.WasDealtDamageAction = (Action<float>)Delegate.Combine(unit.WasDealtDamageAction, new Action<float>(Armor));
ArmoredUnit = ((Component)Unit).gameObject.AddComponent<UnitIsArmored>();
ArmoredUnit.projectileHitEffect = projectileHitEffect;
ArmoredUnit.weaponHitEffect = weaponHitEffect;
ArmoredUnit.parryForce = parryForce;
ArmoredUnit.parryPower = parryPower;
ArmoredUnit.blockPower = blockPower;
MaxArmorHealth = armorHealth;
ArmorListeners = ((Component)Unit).GetComponentsInChildren<AchillesArmorEvent>();
}
public void Armor(float damage)
{
if (ArmorDisabled)
{
return;
}
DataHandler data = Unit.data;
data.health += damage;
armorHealth -= damage;
armorHealth = Mathf.Clamp(armorHealth, 0f, MaxArmorHealth);
if (armorHealth <= 0f)
{
ArmorDisabled = true;
armorDisableEvent.Invoke();
AchillesArmorEvent[] armorListeners = ArmorListeners;
for (int i = 0; i < armorListeners.Length; i++)
{
armorListeners[i].OnArmorDeactivated();
}
ArmoredUnit.armorActive = false;
}
}
public void Update()
{
if (ArmorDisabled)
{
ArmorDisabledCounter += Time.deltaTime;
if (ArmorDisabledCounter >= armorDisabledTime)
{
ArmorDisabledCounter = 0f;
ArmorDisabled = false;
armorHealth = MaxA