using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using REPOLib.Objects.Sdk;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Empress")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5f1b735e473ca4ccf3b383128fbebd889cb564da")]
[assembly: AssemblyProduct("EmpressUltrakill")]
[assembly: AssemblyTitle("EmpressUltrakill")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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;
}
}
}
namespace EmpressUltrakill
{
internal sealed class EmpressSwordsmachineAudio : MonoBehaviour
{
private const float DefaultSpatialBlend = 1f;
private const float DefaultMinDistance = 2.2f;
private const float DefaultMaxDistance = 28f;
private const float SeePlayerCooldown = 0.8f;
private const float HurtFeedbackCooldown = 0.14f;
private const float HurtFeedbackVolume = 1f;
private AudioSource _ambientSource = null;
private AudioSource _voiceSource = null;
private AudioSource _impactSource = null;
private AudioSource _hurtSource = null;
private AudioClip? _ambientClip;
private AudioClip? _seePlayerClip;
private AudioClip? _hitClip;
private AudioClip[] _hurtBeepClips = Array.Empty<AudioClip>();
private EmpressSwordsmachineState _lastState;
private int _hurtBeepIndex;
private float _seePlayerTimer;
private float _hurtFeedbackTimer;
private bool _initialized;
private bool _loadStarted;
private bool _stateTracked;
internal void Initialize()
{
if (!_initialized)
{
_ambientSource = CreateSource("AmbientSource", loop: true);
_voiceSource = CreateSource("VoiceSource", loop: false);
_impactSource = CreateSource("ImpactSource", loop: false);
_hurtSource = CreateSource("HurtSource", loop: false, 0.82f, 4.5f, 36f);
_hurtBeepClips = CreateHurtBeepSet();
_lastState = EmpressSwordsmachineState.SpawnIntro;
_initialized = true;
if (!_loadStarted)
{
_loadStarted = true;
((MonoBehaviour)this).StartCoroutine(LoadClipsRoutine());
}
}
}
internal void UpdateState(EmpressSwordsmachineState state)
{
if (!_initialized)
{
Initialize();
}
if (_seePlayerTimer > 0f)
{
_seePlayerTimer -= Time.deltaTime;
}
if (_hurtFeedbackTimer > 0f)
{
_hurtFeedbackTimer -= Time.deltaTime;
}
TryStartAmbientLoop();
if (!_stateTracked)
{
_lastState = state;
_stateTracked = true;
return;
}
if (state == EmpressSwordsmachineState.Windup && _lastState != EmpressSwordsmachineState.Windup)
{
PlaySeePlayerCue();
}
_lastState = state;
}
internal void PlaySlamImpact()
{
if (!_initialized)
{
Initialize();
}
if ((Object)(object)_hitClip != (Object)null)
{
_impactSource.PlayOneShot(_hitClip, 1f);
}
}
internal void PlayHurtFeedback()
{
if (!_initialized)
{
Initialize();
}
if (!(_hurtFeedbackTimer > 0f) && _hurtBeepClips.Length != 0)
{
_hurtFeedbackTimer = 0.14f;
AudioClip val = _hurtBeepClips[_hurtBeepIndex];
_hurtBeepIndex = (_hurtBeepIndex + 1) % _hurtBeepClips.Length;
_hurtSource.pitch = 0.98f + (float)_hurtBeepIndex * 0.04f;
_hurtSource.PlayOneShot(val, 1f);
}
}
private IEnumerator LoadClipsRoutine()
{
yield return LoadClipInto(EmpressUltrakillPlugin.GetSoundPath("ambient.mp3"), delegate(AudioClip? clip)
{
_ambientClip = clip;
});
yield return LoadClipInto(EmpressUltrakillPlugin.GetSoundPath("see player.mp3"), delegate(AudioClip? clip)
{
_seePlayerClip = clip;
});
yield return LoadClipInto(EmpressUltrakillPlugin.GetSoundPath("hit.mp3"), delegate(AudioClip? clip)
{
_hitClip = clip;
});
TryStartAmbientLoop();
}
private IEnumerator LoadClipInto(string path, Action<AudioClip?> setter)
{
if (!File.Exists(path))
{
EmpressUltrakillPlugin.Log.LogWarning((object)("Missing Empress Swordsmachine sound file: " + path));
setter(null);
yield break;
}
UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(path).AbsoluteUri, (AudioType)13);
try
{
yield return request.SendWebRequest();
if ((int)request.result != 1)
{
EmpressUltrakillPlugin.Log.LogWarning((object)("Failed to load Empress Swordsmachine sound '" + path + "': " + request.error));
setter(null);
}
else
{
AudioClip clip = DownloadHandlerAudioClip.GetContent(request);
((Object)clip).name = Path.GetFileNameWithoutExtension(path);
setter(clip);
}
}
finally
{
((IDisposable)request)?.Dispose();
}
}
private void TryStartAmbientLoop()
{
if (!((Object)(object)_ambientClip == (Object)null) && !_ambientSource.isPlaying)
{
_ambientSource.clip = _ambientClip;
_ambientSource.volume = 0.4f;
_ambientSource.Play();
}
}
private void PlaySeePlayerCue()
{
if (!((Object)(object)_seePlayerClip == (Object)null) && !(_seePlayerTimer > 0f))
{
_seePlayerTimer = 0.8f;
_voiceSource.PlayOneShot(_seePlayerClip, 1f);
}
}
private AudioSource CreateSource(string sourceName, bool loop, float spatialBlend = 1f, float minDistance = 2.2f, float maxDistance = 28f)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
GameObject val = new GameObject(sourceName);
val.transform.SetParent(((Component)this).transform, false);
AudioSource val2 = val.AddComponent<AudioSource>();
val2.playOnAwake = false;
val2.loop = loop;
val2.spatialBlend = spatialBlend;
val2.minDistance = minDistance;
val2.maxDistance = maxDistance;
val2.rolloffMode = (AudioRolloffMode)1;
val2.dopplerLevel = 0f;
val2.volume = 0.4f;
return val2;
}
private static AudioClip[] CreateHurtBeepSet()
{
return (AudioClip[])(object)new AudioClip[3]
{
CreateHurtBeep("EmpressHurtBeepA", 520f, 780f),
CreateHurtBeep("EmpressHurtBeepB", 610f, 910f),
CreateHurtBeep("EmpressHurtBeepC", 700f, 1040f)
};
}
private static AudioClip CreateHurtBeep(string clipName, float baseFrequency, float overtoneFrequency)
{
int num = Mathf.CeilToInt(3087f);
float[] array = new float[num];
for (int i = 0; i < num; i++)
{
float num2 = (float)i / 22050f;
float num3 = (float)i / Mathf.Max(1f, (float)num - 1f);
float num4 = Mathf.Lerp(baseFrequency, overtoneFrequency, num3);
float num5 = ((num3 < 0.72f) ? Mathf.Lerp(0.55f, 1f, num3 / 0.72f) : Mathf.Lerp(1f, 0f, (num3 - 0.72f) / 0.28f));
float num6 = Mathf.Sin(num2 * num4 * MathF.PI * 2f) * 0.78f + Mathf.Sin(num2 * (num4 * 1.85f) * MathF.PI * 2f) * 0.18f + Mathf.Sin(num2 * (num4 * 0.5f) * MathF.PI * 2f) * 0.12f;
array[i] = Mathf.Clamp(num6 * num5 * 0.5f, -1f, 1f);
}
AudioClip val = AudioClip.Create(clipName, num, 1, 22050, false);
val.SetData(array, 0);
return val;
}
}
internal enum EmpressSwordsmachineState
{
SpawnIntro,
Patrol,
Hunt,
Windup,
Dash,
Slam,
Recover,
Reposition,
Stunned
}
internal sealed class EmpressSwordsmachineBrain : MonoBehaviour, IPunObservable
{
private const float DetectionDistance = 26f;
private const float PursuitDistance = 34f;
private const float SightDashDistance = 30f;
private const float SpawnIntroTime = 1f;
private const float WindupTime = 0.42f;
private const float DashTime = 0.65f;
private const float SlamTime = 0.42f;
private const float RecoverTime = 1f;
private const float RepositionTime = 1.6f;
private const float SlamRadius = 3.25f;
private const float VisionHalfAngle = 65f;
private const float StallRecoverTime = 1.75f;
private const float StallMovementThreshold = 0.08f;
private const float ForceLeaveGraceTime = 1200f;
private const float DoorPushCooldownTime = 0.12f;
private const float DoorPushProbeDistance = 0.72f;
private const float DoorPushProbeRadius = 0.55f;
private const float DoorPushForce = 2.8f;
private const float DoorPushTorque = 1.1f;
private static readonly int SightObstructionMask = LayerMask.GetMask(new string[5] { "Default", "PhysGrabObject", "PhysGrabObjectCart", "PhysGrabObjectHinge", "StaticGrabObject" });
private static readonly int DoorPushMask = LayerMask.GetMask(new string[1] { "PhysGrabObjectHinge" });
private static readonly Collider[] DoorPushHits = (Collider[])(object)new Collider[8];
private EnemyParent _enemyParent = null;
private Enemy _enemy = null;
private EnemyNavMeshAgent _enemyNavMeshAgent = null;
private EmpressSwordsmachineVisual _visual = null;
private EmpressSwordsmachineAudio _audio = null;
private Transform _centerTransform = null;
private NavMeshAgent _navMeshAgent = null;
private EmpressSwordsmachineState _state;
private PlayerAvatar? _targetPlayer;
private Quaternion _networkRotation;
private Vector3 _dashDestination;
private Vector3 _slamPoint;
private Vector3 _moveDestination;
private Vector3 _lastPosition;
private float _stateTimer;
private float _decisionTimer;
private float _attackCooldown;
private float _dashTimer;
private float _doorPushCooldown;
private float _localVelX;
private float _localVelZ;
private float _remoteStateTimer;
private float _spawnLifetime;
private float _stallTimer;
private int _failedDashes;
private int _networkTargetViewId = -1;
private bool _spawnInitialized;
private bool _slamTriggered;
private bool _initialized;
private bool _wasStunned;
internal void Initialize(EnemyParent enemyParent, Enemy enemy, EnemyNavMeshAgent enemyNavMeshAgent, EmpressSwordsmachineVisual visual, EmpressSwordsmachineAudio audio, Transform centerTransform)
{
//IL_0041: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
_enemyParent = enemyParent;
_enemy = enemy;
_enemyNavMeshAgent = enemyNavMeshAgent;
_visual = visual;
_audio = audio;
_centerTransform = centerTransform;
_navMeshAgent = RepoEnemyAccess.GetAgent(enemyNavMeshAgent);
_networkRotation = ((Component)this).transform.rotation;
_lastPosition = ((Component)this).transform.position;
_initialized = true;
}
internal void HandleSpawnEvent()
{
//IL_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
if (_initialized)
{
EnsureRuntimeReady();
_state = EmpressSwordsmachineState.SpawnIntro;
_stateTimer = 1f;
_decisionTimer = 0f;
_attackCooldown = 0.45f;
_failedDashes = 0;
_slamTriggered = false;
_spawnInitialized = true;
_wasStunned = false;
_targetPlayer = null;
_moveDestination = ((Component)this).transform.position;
_dashDestination = ((Component)this).transform.position;
_slamPoint = ((Component)this).transform.position;
_networkTargetViewId = -1;
RepoEnemyAccess.SetTargetPlayer(_enemy, null, -1);
_enemy.CurrentState = (EnemyState)1;
_enemyNavMeshAgent.Stop(0.2f);
_lastPosition = ((Component)this).transform.position;
_spawnLifetime = 0f;
_stallTimer = 0f;
}
}
internal void HandleDeathStart()
{
if (_initialized)
{
_state = EmpressSwordsmachineState.Stunned;
_stateTimer = 0f;
_decisionTimer = 0f;
_attackCooldown = 0f;
_dashTimer = 0f;
_slamTriggered = true;
_enemyNavMeshAgent.Stop(0.1f);
}
}
internal void HandleDeath()
{
if (_initialized)
{
_enemyNavMeshAgent.Stop(0.1f);
if (SemiFunc.IsMasterClientOrSingleplayer())
{
_enemyParent.Despawn();
}
}
}
private void Update()
{
//IL_007a: 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_0121: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
if (_initialized && _spawnInitialized && IsGameplayReady())
{
EnemyHealth health = RepoEnemyAccess.GetHealth(_enemy);
if ((Object)(object)health != (Object)null && (RepoEnemyAccess.GetEnemyHealthDeadImpulse(health) || RepoEnemyAccess.GetEnemyHealthDead(health)))
{
_enemyNavMeshAgent.Stop(0.1f);
UpdateVisuals(EmpressSwordsmachineState.Stunned, 0f);
_lastPosition = ((Component)this).transform.position;
}
else if (GameManager.Multiplayer() && !RepoEnemyAccess.GetMasterClient(_enemy))
{
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, _networkRotation, Time.deltaTime * 14f);
UpdateRemoteTarget();
UpdateVisuals(_state, _remoteStateTimer);
_lastPosition = ((Component)this).transform.position;
}
else
{
TickHostLogic();
UpdateVisuals(_state, _stateTimer);
_lastPosition = ((Component)this).transform.position;
}
}
}
private void TickHostLogic()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Invalid comparison between Unknown and I4
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
if (!RepoEnemyAccess.GetSpawned(_enemyParent))
{
_enemyNavMeshAgent.Stop(0.1f);
return;
}
if ((int)_enemy.CurrentState == 11)
{
_enemyNavMeshAgent.Stop(0.1f);
if (SemiFunc.IsMasterClientOrSingleplayer())
{
_enemyParent.Despawn();
}
return;
}
_spawnLifetime += Time.deltaTime;
if (_spawnLifetime >= 1200f && _state == EmpressSwordsmachineState.Patrol && (Object)(object)_targetPlayer == (Object)null && SemiFunc.EnemyForceLeave(_enemy))
{
_enemyParent.Despawn();
SyncNetworkState();
return;
}
if (_attackCooldown > 0f)
{
_attackCooldown -= Time.deltaTime;
}
if (_doorPushCooldown > 0f)
{
_doorPushCooldown -= Time.deltaTime;
}
if (_enemy.IsStunned())
{
_state = EmpressSwordsmachineState.Stunned;
_enemy.CurrentState = (EnemyState)9;
_enemyNavMeshAgent.Stop(0.1f);
FaceClosestPlayer(8f);
_failedDashes = 0;
_wasStunned = true;
SyncNetworkState();
return;
}
if (_wasStunned)
{
_wasStunned = false;
EnterPatrol();
}
UpdateStallRecovery();
if (_stateTimer > 0f)
{
_stateTimer -= Time.deltaTime;
}
switch (_state)
{
case EmpressSwordsmachineState.SpawnIntro:
TickSpawnIntro();
break;
case EmpressSwordsmachineState.Patrol:
TickPatrol();
break;
case EmpressSwordsmachineState.Hunt:
TickHunt();
break;
case EmpressSwordsmachineState.Windup:
TickWindup();
break;
case EmpressSwordsmachineState.Dash:
TickDash();
break;
case EmpressSwordsmachineState.Slam:
TickSlam();
break;
case EmpressSwordsmachineState.Recover:
TickRecover();
break;
case EmpressSwordsmachineState.Reposition:
EnterPatrol();
break;
case EmpressSwordsmachineState.Stunned:
EnterPatrol();
break;
}
UpdateDoorInteraction();
SyncNetworkState();
}
private void TickSpawnIntro()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
_enemy.CurrentState = (EnemyState)1;
_enemyNavMeshAgent.Stop(0.2f);
if (_stateTimer <= 0f && !SemiFunc.EnemySpawnIdlePause())
{
EnterPatrol();
}
}
private void TickPatrol()
{
//IL_0008: 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_009a: 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_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: 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_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: 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)
_enemy.CurrentState = (EnemyState)2;
PlayerAvatar visibleTarget = GetVisibleTarget(26f);
if ((Object)(object)visibleTarget != (Object)null && _attackCooldown <= 0f)
{
EnterWindup(visibleTarget);
return;
}
if (SemiFunc.EnemySpawnIdlePause())
{
_enemyNavMeshAgent.Stop(0.2f);
return;
}
if (((Behaviour)_navMeshAgent).enabled && _navMeshAgent.isOnNavMesh && _navMeshAgent.hasPath && Vector3.Distance(((Component)this).transform.position, _moveDestination) > 1.25f)
{
Vector3 desiredVelocity = _navMeshAgent.desiredVelocity;
if (((Vector3)(ref desiredVelocity)).sqrMagnitude > 0.04f)
{
FaceTravelDirection(5f);
return;
}
}
if (_decisionTimer > 0f)
{
_decisionTimer -= Time.deltaTime;
FaceTravelDirection(5f);
return;
}
_decisionTimer = 1.9f;
Vector3 val = SemiFunc.EnemyRoamFindPoint(((Component)this).transform.position);
if (((Vector3)(ref val)).sqrMagnitude > 0.001f)
{
_moveDestination = val;
SetMoveDestination(val, 1.2f, 9f);
FacePosition(val, 4f);
}
else
{
_enemyNavMeshAgent.Stop(0.25f);
}
FaceTravelDirection(5f);
}
private void TickHunt()
{
//IL_0032: 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_0050: 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_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)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
PlayerAvatar visibleTarget = GetVisibleTarget(34f);
if ((Object)(object)visibleTarget == (Object)null)
{
EnterPatrol();
return;
}
_targetPlayer = visibleTarget;
float num = Vector3.Distance(_centerTransform.position, GetSightTargetPosition(_targetPlayer));
_enemy.CurrentState = (EnemyState)3;
if (_attackCooldown <= 0f && num <= 30f)
{
EnterWindup(_targetPlayer);
return;
}
if (num > 34f)
{
EnterPatrol();
return;
}
if (_decisionTimer > 0f)
{
_decisionTimer -= Time.deltaTime;
return;
}
_decisionTimer = 0.2f;
_moveDestination = SampleNavMeshPosition(((Component)_targetPlayer).transform.position, 2.5f, ((Component)_targetPlayer).transform.position);
SetMoveDestination(_moveDestination, 1.45f, 11f);
FaceTravelDirection(8f);
}
private void TickWindup()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_00b4: Unknown result type (might be due to invalid IL or missing references)
_enemy.CurrentState = (EnemyState)3;
_enemyParent.SpawnedTimerPause(0.3f);
_enemyNavMeshAgent.Stop(0.2f);
_targetPlayer = ResolveTarget(_targetPlayer);
if ((Object)(object)_targetPlayer == (Object)null)
{
EnterPatrol();
return;
}
Vector3 sightTargetPosition = GetSightTargetPosition(_targetPlayer);
float num = Vector3.Distance(_centerTransform.position, sightTargetPosition);
if (num > 30f || !HasClearRay(_centerTransform.position, sightTargetPosition, num, _targetPlayer))
{
EnterPatrol();
return;
}
FacePosition(_slamPoint, 18f);
if (_stateTimer <= 0f)
{
BeginDash();
}
}
private void TickDash()
{
//IL_0008: 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_005c: 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_0085: Unknown result type (might be due to invalid IL or missing references)
_enemy.CurrentState = (EnemyState)4;
_enemyParent.SpawnedTimerPause(0.5f);
if (_dashTimer > 0f)
{
_dashTimer -= Time.deltaTime;
}
SetMoveDestination(_dashDestination, 16f, 220f);
FacePosition(_slamPoint, 22f);
if (_dashTimer <= 0f || Vector3.Distance(((Component)this).transform.position, _dashDestination) < 1.45f)
{
BeginSlam();
}
}
private void TickSlam()
{
//IL_0008: 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)
_enemy.CurrentState = (EnemyState)4;
_enemyParent.SpawnedTimerPause(0.4f);
_enemyNavMeshAgent.Stop(0.2f);
FacePosition(_slamPoint, 28f);
if (!_slamTriggered && _stateTimer <= 0.12f)
{
PerformSlamImpact();
}
if (_stateTimer <= 0f)
{
EnterRecover();
}
}
private void TickRecover()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
_enemy.CurrentState = (EnemyState)8;
_enemyNavMeshAgent.Stop(0.15f);
if ((Object)(object)_targetPlayer != (Object)null && !RepoEnemyAccess.IsDisabled(_targetPlayer))
{
FacePlayer(_targetPlayer, 8f);
}
if (!(_stateTimer > 0f))
{
PlayerAvatar visibleTarget = GetVisibleTarget(26f);
if ((Object)(object)visibleTarget != (Object)null && _attackCooldown <= 0f)
{
EnterWindup(visibleTarget);
}
else if ((Object)(object)_targetPlayer == (Object)null || RepoEnemyAccess.IsDisabled(_targetPlayer))
{
EnterPatrol();
}
else
{
EnterPatrol();
}
}
}
private void TickReposition()
{
EnterPatrol();
}
private void EnterPatrol()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
_state = EmpressSwordsmachineState.Patrol;
_stateTimer = 0f;
_decisionTimer = 0f;
_slamTriggered = false;
_targetPlayer = null;
_stallTimer = 0f;
_enemy.CurrentState = (EnemyState)2;
RepoEnemyAccess.SetTargetPlayer(_enemy, null, -1);
}
private void EnterHunt(PlayerAvatar? player)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
_state = EmpressSwordsmachineState.Hunt;
_stateTimer = 0f;
_decisionTimer = 0f;
_slamTriggered = false;
_targetPlayer = ResolveTarget(player) ?? GetClosestValidPlayer();
_enemy.CurrentState = (EnemyState)5;
}
private void EnterWindup(PlayerAvatar player)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
_state = EmpressSwordsmachineState.Windup;
_stateTimer = 0.42f;
_decisionTimer = 0f;
_slamTriggered = false;
_stallTimer = 0f;
_targetPlayer = player;
LockChargeTarget(player);
_enemy.CurrentState = (EnemyState)3;
_enemyNavMeshAgent.Stop(0.25f);
_targetPlayer.EnemyVisionFreezeTimerSet(0.2f);
}
private void BeginDash()
{
//IL_002c: 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_003d: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_007b: 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)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_009a: 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)
_state = EmpressSwordsmachineState.Dash;
_dashTimer = 0.65f;
_slamTriggered = false;
_stallTimer = 0f;
_enemy.CurrentState = (EnemyState)4;
if (Vector3.Distance(_dashDestination, ((Component)this).transform.position) < 0.75f)
{
Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * 8f;
_dashDestination = SampleNavMeshPosition(val, 2.75f, val);
_slamPoint = _dashDestination;
_moveDestination = _dashDestination;
}
}
private void BeginSlam()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//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_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_0079: Unknown result type (might be due to invalid IL or missing references)
_state = EmpressSwordsmachineState.Slam;
_stateTimer = 0.42f;
_slamTriggered = false;
_stallTimer = 0f;
_enemy.CurrentState = (EnemyState)4;
_enemyNavMeshAgent.Stop(0.25f);
_slamPoint = SampleNavMeshPosition(((Component)this).transform.position + ((Component)this).transform.forward * 1.2f, 2f, _dashDestination);
}
private void EnterRecover()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
_state = EmpressSwordsmachineState.Recover;
_stateTimer = 1f;
_decisionTimer = 0f;
_attackCooldown = 2.2f;
_stallTimer = 0f;
_enemy.CurrentState = (EnemyState)8;
_enemyNavMeshAgent.Stop(0.2f);
}
private void EnterReposition(PlayerAvatar? focusPlayer)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
_state = EmpressSwordsmachineState.Reposition;
_stateTimer = 1.6f;
_decisionTimer = 0f;
_slamTriggered = false;
_targetPlayer = ResolveTarget(focusPlayer) ?? GetClosestValidPlayer();
_enemy.CurrentState = (EnemyState)7;
}
private void PerformSlamImpact()
{
//IL_001a: 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_0077: 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_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_00b2: Unknown result type (might be due to invalid IL or missing references)
if (_slamTriggered)
{
return;
}
_slamTriggered = true;
TriggerGroundSlamEffect(_slamPoint);
int num = SemiFunc.EnemyGetIndex(_enemy);
bool flag = false;
foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
{
if (IsTargetValid(item))
{
Transform targetTransform = GetTargetTransform(item);
float num2 = Vector3.Distance(targetTransform.position, _slamPoint);
if (!(num2 > 3.25f) && HasClearRay(_slamPoint + Vector3.up * 0.3f, targetTransform.position, num2 + 0.25f, item))
{
item.EnemyVisionFreezeTimerSet(0.35f);
item.PlayerDeath(num);
flag = true;
}
}
}
_failedDashes = ((!flag) ? (_failedDashes + 1) : 0);
}
private PlayerAvatar? GetVisibleTarget(float maxDistance)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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_0070: 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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: 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)
PlayerAvatar result = null;
float num = float.MinValue;
foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
{
if (!IsTargetValid(item))
{
continue;
}
Vector3 sightTargetPosition = GetSightTargetPosition(item);
Vector3 val = sightTargetPosition - _centerTransform.position;
float magnitude = ((Vector3)(ref val)).magnitude;
if (magnitude > maxDistance)
{
continue;
}
Vector3 val2 = val;
val2.y = 0f;
if ((!(((Vector3)(ref val2)).sqrMagnitude > 0.0001f) || !(Vector3.Angle(((Component)this).transform.forward, ((Vector3)(ref val2)).normalized) > 65f)) && HasClearRay(_centerTransform.position, sightTargetPosition, magnitude, item))
{
float num2 = 0f - magnitude;
if (num2 > num)
{
num = num2;
result = item;
}
}
}
return result;
}
private PlayerAvatar? GetClosestValidPlayer()
{
//IL_0039: 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)
PlayerAvatar result = null;
float num = float.MaxValue;
foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
{
if (IsTargetValid(item))
{
float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position);
if (num2 < num)
{
num = num2;
result = item;
}
}
}
return result;
}
private PlayerAvatar? ResolveTarget(PlayerAvatar? player)
{
return ((Object)(object)player != (Object)null && IsTargetValid(player)) ? player : null;
}
private bool IsTargetValid(PlayerAvatar? player)
{
return (Object)(object)player != (Object)null && !RepoEnemyAccess.IsDisabled(player) && !RepoEnemyAccess.IsDeadSet(player);
}
[PunRPC]
private void GroundSlamRpc(Vector3 position, PhotonMessageInfo info = default(PhotonMessageInfo))
{
//IL_0001: 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)
if (SemiFunc.MasterOnlyRPC(info) || !GameManager.Multiplayer())
{
EnsureRuntimeReady();
_audio.PlaySlamImpact();
_visual.TriggerGroundSlam(position, 3.25f);
}
}
private void TriggerGroundSlamEffect(Vector3 position)
{
//IL_0027: 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_0066: Unknown result type (might be due to invalid IL or missing references)
EnsureRuntimeReady();
if (!GameManager.Multiplayer())
{
_audio.PlaySlamImpact();
_visual.TriggerGroundSlam(position, 3.25f);
return;
}
PhotonView val = RepoEnemyAccess.GetPhotonView(_enemy) ?? ((Component)this).GetComponent<PhotonView>();
if ((Object)(object)val != (Object)null)
{
val.RPC("GroundSlamRpc", (RpcTarget)0, new object[1] { position });
}
else
{
_visual.TriggerGroundSlam(position, 3.25f);
}
}
private void UpdateVisuals(EmpressSwordsmachineState visualState, float stateTimer)
{
//IL_0007: 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_0017: 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_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)
//IL_0040: 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_0156: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)this).transform.position - _lastPosition;
Vector3 val2 = ((Component)this).transform.InverseTransformDirection(val / Mathf.Max(Time.deltaTime, 0.0001f));
_localVelX = Mathf.Lerp(_localVelX, val2.x, 10f * Time.deltaTime);
_localVelZ = Mathf.Lerp(_localVelZ, val2.z, 10f * Time.deltaTime);
if (_enemy.IsStunned())
{
visualState = EmpressSwordsmachineState.Stunned;
}
if (1 == 0)
{
}
float num = visualState switch
{
EmpressSwordsmachineState.Windup => 1f - Mathf.Clamp01(stateTimer / 0.42f),
EmpressSwordsmachineState.Dash => 0.75f,
EmpressSwordsmachineState.Slam => 1f,
EmpressSwordsmachineState.Recover => 0.25f,
_ => 0f,
};
if (1 == 0)
{
}
float attackCharge = num;
object obj;
if (!((Object)(object)_targetPlayer?.PlayerVisionTarget != (Object)null))
{
PlayerAvatar? targetPlayer = _targetPlayer;
obj = ((targetPlayer != null) ? ((Component)targetPlayer).transform : null);
}
else
{
obj = _targetPlayer.PlayerVisionTarget.VisionTransform;
}
Transform lookTarget = (Transform)obj;
_audio.UpdateState(visualState);
_visual.UpdatePose(visualState, new Vector3(_localVelX, 0f, _localVelZ), lookTarget, attackCharge);
}
private void SyncNetworkState()
{
_networkTargetViewId = (((Object)(object)_targetPlayer != (Object)null) ? _targetPlayer.photonView.ViewID : (-1));
RepoEnemyAccess.SetTargetPlayer(_enemy, _targetPlayer, _networkTargetViewId);
}
private void UpdateRemoteTarget()
{
PlayerAvatar val = null;
if (_networkTargetViewId != -1)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
{
if (!RepoEnemyAccess.IsDisabled(item) && item.photonView.ViewID == _networkTargetViewId)
{
val = item;
break;
}
}
}
_targetPlayer = val;
RepoEnemyAccess.SetTargetPlayer(_enemy, val, _networkTargetViewId);
}
private void SetMoveDestination(Vector3 destination, float speed, float acceleration)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
if (EnsureRuntimeReady())
{
_enemyNavMeshAgent.UpdateAgent(speed, acceleration);
_enemyNavMeshAgent.SetDestination(destination);
}
}
private void FacePlayer(PlayerAvatar player, float turnSpeed)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
FacePosition(GetTargetTransform(player).position, turnSpeed);
}
private void FaceClosestPlayer(float turnSpeed)
{
PlayerAvatar closestValidPlayer = GetClosestValidPlayer();
if ((Object)(object)closestValidPlayer != (Object)null)
{
FacePlayer(closestValidPlayer, turnSpeed);
}
}
private void FacePosition(Vector3 position, float turnSpeed)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//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_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)
//IL_0048: 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_005a: 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)
Vector3 val = position - ((Component)this).transform.position;
val.y = 0f;
if (!(((Vector3)(ref val)).sqrMagnitude <= 0.0001f))
{
Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up);
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, turnSpeed * Time.deltaTime);
}
}
private void FaceTravelDirection(float turnSpeed)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_0099: 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_009f: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Vector3.zero;
if (((Behaviour)_navMeshAgent).enabled && _navMeshAgent.isOnNavMesh)
{
val = _navMeshAgent.desiredVelocity;
}
val.y = 0f;
if (((Vector3)(ref val)).sqrMagnitude <= 0.01f)
{
val = _moveDestination - ((Component)this).transform.position;
val.y = 0f;
}
if (!(((Vector3)(ref val)).sqrMagnitude <= 0.01f))
{
FacePosition(((Component)this).transform.position + val, turnSpeed);
}
}
private Transform GetTargetTransform(PlayerAvatar player)
{
return ((Object)(object)player.PlayerVisionTarget != (Object)null) ? player.PlayerVisionTarget.VisionTransform : ((Component)player).transform;
}
private bool HasClearRay(Vector3 from, Vector3 to, float distance, PlayerAvatar? player)
{
//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_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: 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_0011: 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_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)
Vector3 val = to - from;
Vector3 normalized = ((Vector3)(ref val)).normalized;
RaycastHit[] array = Physics.RaycastAll(from, normalized, distance, SightObstructionMask, (QueryTriggerInteraction)1);
RaycastHit[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
RaycastHit val2 = array2[i];
if (!((RaycastHit)(ref val2)).transform.IsChildOf(((Component)this).transform) && (!((Object)(object)player != (Object)null) || !((RaycastHit)(ref val2)).transform.IsChildOf(((Component)player).transform)))
{
return false;
}
}
return true;
}
private Vector3 SampleNavMeshPosition(Vector3 desired, float range, Vector3 fallback)
{
//IL_0001: 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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0034: 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_0037: Unknown result type (might be due to invalid IL or missing references)
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(desired, ref val, range, -1))
{
return ((NavMeshHit)(ref val)).position;
}
if (NavMesh.SamplePosition(fallback, ref val, range, -1))
{
return ((NavMeshHit)(ref val)).position;
}
return fallback;
}
private void LockChargeTarget(PlayerAvatar player)
{
//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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_0031: 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_004a: 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_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_006a: 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_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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
Vector3 position = ((Component)player).transform.position;
Vector3 val = position - ((Component)this).transform.position;
val.y = 0f;
Vector3 fallback = ((Component)this).transform.position + ((((Vector3)(ref val)).sqrMagnitude > 0.001f) ? ((Vector3)(ref val)).normalized : ((Component)this).transform.forward) * 8f;
_dashDestination = SampleNavMeshPosition(position, 2.75f, fallback);
_slamPoint = _dashDestination;
_moveDestination = _dashDestination;
}
private Vector3 GetSightTargetPosition(PlayerAvatar player)
{
//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_0016: 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_0023: Unknown result type (might be due to invalid IL or missing references)
return ((Component)player).transform.position + Vector3.up * 0.95f;
}
private void UpdateStallRecovery()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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)
bool flag;
switch (_state)
{
case EmpressSwordsmachineState.SpawnIntro:
case EmpressSwordsmachineState.Windup:
case EmpressSwordsmachineState.Slam:
case EmpressSwordsmachineState.Recover:
case EmpressSwordsmachineState.Stunned:
flag = true;
break;
default:
flag = false;
break;
}
if (flag)
{
_stallTimer = 0f;
return;
}
bool flag2 = _state == EmpressSwordsmachineState.Dash;
if (!flag2)
{
flag2 = Vector3.Distance(((Component)this).transform.position, _moveDestination) > 1.25f;
}
if (!flag2)
{
_stallTimer = 0f;
return;
}
if (Vector3.Distance(((Component)this).transform.position, _lastPosition) > 0.08f)
{
_stallTimer = 0f;
return;
}
_stallTimer += Time.deltaTime;
if (_stallTimer >= 1.75f)
{
RecoverFromMovementStall();
}
}
private void RecoverFromMovementStall()
{
//IL_006c: 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_00bc: 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)
_stallTimer = 0f;
_decisionTimer = 0f;
_dashTimer = 0f;
_doorPushCooldown = 0f;
_slamTriggered = false;
_targetPlayer = null;
RepoEnemyAccess.SetTargetPlayer(_enemy, null, -1);
if (((Behaviour)_navMeshAgent).enabled)
{
_navMeshAgent.ResetPath();
}
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(((Component)this).transform.position, ref val, 14f, -1))
{
((Behaviour)_navMeshAgent).enabled = true;
_navMeshAgent.Warp(((NavMeshHit)(ref val)).position);
}
_moveDestination = ((Component)this).transform.position;
_enemy.CurrentState = (EnemyState)2;
_state = EmpressSwordsmachineState.Patrol;
_enemyNavMeshAgent.Stop(0f);
}
private void UpdateDoorInteraction()
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_009a: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
bool flag = _doorPushCooldown > 0f;
bool flag2 = flag;
if (!flag2)
{
bool flag3;
switch (_state)
{
case EmpressSwordsmachineState.SpawnIntro:
case EmpressSwordsmachineState.Windup:
case EmpressSwordsmachineState.Slam:
case EmpressSwordsmachineState.Recover:
case EmpressSwordsmachineState.Stunned:
flag3 = true;
break;
default:
flag3 = false;
break;
}
flag2 = flag3;
}
if (flag2)
{
return;
}
Vector3 doorPushDirection = GetDoorPushDirection();
if (((Vector3)(ref doorPushDirection)).sqrMagnitude <= 0.04f)
{
return;
}
Vector3 val = _centerTransform.position + doorPushDirection * 0.72f;
int num = Physics.OverlapSphereNonAlloc(val, 0.55f, DoorPushHits, DoorPushMask, (QueryTriggerInteraction)1);
if (num <= 0)
{
return;
}
for (int i = 0; i < num; i++)
{
Collider val2 = DoorPushHits[i];
DoorPushHits[i] = null;
if ((Object)(object)val2 == (Object)null || ((Component)val2).transform.IsChildOf(((Component)this).transform))
{
continue;
}
PhysGrabHinge componentInParent = ((Component)val2).GetComponentInParent<PhysGrabHinge>();
if ((Object)(object)componentInParent == (Object)null)
{
continue;
}
PhysGrabObject component = ((Component)componentInParent).GetComponent<PhysGrabObject>();
Rigidbody component2 = ((Component)componentInParent).GetComponent<Rigidbody>();
HingeJoint component3 = ((Component)componentInParent).GetComponent<HingeJoint>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component2 == (Object)null) && !((Object)(object)component3 == (Object)null) && !component2.isKinematic)
{
Vector3 val3 = val2.ClosestPoint(val);
Vector3 val4 = doorPushDirection * 2.8f;
val4.y = Mathf.Max(val4.y, 0.08f);
Vector3 val5 = ((Component)componentInParent).transform.position - ((Component)this).transform.position;
val5.y = 0f;
float num2 = Mathf.Sign(Vector3.Dot(Vector3.Cross(val5, doorPushDirection), Vector3.up));
if (Mathf.Abs(num2) < 0.01f)
{
num2 = 1f;
}
component.EnemyInteractTimeSet();
component2.AddForceAtPosition(val4, val3, (ForceMode)1);
component2.AddTorque(Vector3.up * (1.1f * num2), (ForceMode)1);
_doorPushCooldown = 0.12f;
break;
}
}
}
private Vector3 GetDoorPushDirection()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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_0032: 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_005a: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_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_00c0: 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_00b8: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Vector3.zero;
if (((Behaviour)_navMeshAgent).enabled && _navMeshAgent.isOnNavMesh)
{
val = _navMeshAgent.desiredVelocity;
}
val.y = 0f;
if (((Vector3)(ref val)).sqrMagnitude > 0.04f)
{
return ((Vector3)(ref val)).normalized;
}
val = ((_state == EmpressSwordsmachineState.Dash) ? (_dashDestination - ((Component)this).transform.position) : (_moveDestination - ((Component)this).transform.position));
val.y = 0f;
return (((Vector3)(ref val)).sqrMagnitude > 0.04f) ? ((Vector3)(ref val)).normalized : Vector3.zero;
}
private bool EnsureRuntimeReady()
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
if (!_visual.Ready)
{
_visual.Build();
_enemy.KillLookAtTransform = _visual.HeadTransform;
_enemy.CustomValuableSpawnTransform = _visual.CoreTransform;
}
if (((Behaviour)_navMeshAgent).enabled && _navMeshAgent.isOnNavMesh)
{
if (!((Behaviour)_enemyNavMeshAgent).enabled)
{
((Behaviour)_enemyNavMeshAgent).enabled = true;
}
return true;
}
Vector3 position = ((Component)_navMeshAgent).transform.position;
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(position, ref val, 6f, -1))
{
((Behaviour)_navMeshAgent).enabled = true;
_navMeshAgent.Warp(((NavMeshHit)(ref val)).position);
if (!((Behaviour)_enemyNavMeshAgent).enabled)
{
((Behaviour)_enemyNavMeshAgent).enabled = true;
}
return true;
}
return false;
}
private bool IsGameplayReady()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Invalid comparison between Unknown and I4
return (Object)(object)LevelGenerator.Instance != (Object)null && LevelGenerator.Instance.Generated && (Object)(object)GameDirector.instance != (Object)null && (int)GameDirector.instance.currentState == 2 && !SemiFunc.RunIsLobbyMenu() && !SemiFunc.MenuLevel();
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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_0038: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterOnlyRPC(info))
{
if (stream.IsWriting)
{
stream.SendNext((object)(int)_state);
stream.SendNext((object)((Component)this).transform.rotation);
stream.SendNext((object)_stateTimer);
stream.SendNext((object)_networkTargetViewId);
}
else
{
_state = (EmpressSwordsmachineState)(int)stream.ReceiveNext();
_networkRotation = (Quaternion)stream.ReceiveNext();
_remoteStateTimer = (float)stream.ReceiveNext();
_networkTargetViewId = (int)stream.ReceiveNext();
}
}
}
}
[DefaultExecutionOrder(-100)]
internal sealed class EmpressSwordsmachineTemplateBootstrap : MonoBehaviour
{
private const string EnableObjectName = "EnableObject";
private const string EnemyObjectName = "EmpressSwordsmachineEnemy";
private const string CenterObjectName = "Center";
private const string TemplateContainerName = "EmpressSwordsmachineTemplateContainer";
private const int SwordsmachineHealth = 240;
private static readonly HashSet<int> TemplateInstanceIds = new HashSet<int>();
private static GameObject? _templateContainer;
private bool _runtimeBuilt;
internal static GameObject CreateTemplate(ManualLogSource log)
{
//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_0023: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
GameObject val = EnsureTemplateContainer();
GameObject val2 = new GameObject("EmpressSwordsmachinePrefab")
{
layer = ResolveLayer("Enemy")
};
val2.transform.SetParent(val.transform, false);
((Object)val2).hideFlags = (HideFlags)61;
val2.transform.position = new Vector3(0f, -5000f, 0f);
TemplateInstanceIds.Add(((Object)val2).GetInstanceID());
BuildTemplateCore(val2.transform);
log.LogInfo((object)"Created Empress Swordsmachine template core.");
return val2;
}
internal static bool IsTemplateInstance(GameObject gameObject)
{
Transform val = gameObject.transform;
while ((Object)(object)val.parent != (Object)null)
{
val = val.parent;
}
return TemplateInstanceIds.Contains(((Object)((Component)val).gameObject).GetInstanceID());
}
private static GameObject EnsureTemplateContainer()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
if ((Object)(object)_templateContainer != (Object)null)
{
return _templateContainer;
}
_templateContainer = new GameObject("EmpressSwordsmachineTemplateContainer");
((Object)_templateContainer).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)_templateContainer);
_templateContainer.SetActive(false);
return _templateContainer;
}
private void Start()
{
if (IsTemplateInstance(((Component)this).gameObject) || _runtimeBuilt)
{
return;
}
_runtimeBuilt = true;
try
{
BuildRuntimeInstance();
}
catch (Exception arg)
{
EmpressUltrakillPlugin.Log.LogError((object)$"Failed to finish Empress Swordsmachine spawn: {arg}");
}
}
private static void BuildTemplateCore(Transform root)
{
//IL_0044: 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_0068: Expected O, but got Unknown
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_00b1: 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_00e7: Expected O, but got Unknown
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
int layer = ResolveLayer("Enemy");
((Component)root).gameObject.layer = layer;
TrySetTag(((Component)root).gameObject, "Enemy");
EnemyParent val = ((Component)root).gameObject.AddComponent<EnemyParent>();
PhotonView val2 = ((Component)root).gameObject.AddComponent<PhotonView>();
val2.Synchronization = (ViewSynchronization)3;
((Behaviour)val2).enabled = false;
((Component)root).gameObject.AddComponent<EmpressSwordsmachineTemplateBootstrap>();
GameObject val3 = new GameObject("EnableObject");
val3.transform.SetParent(root, false);
val3.layer = layer;
TrySetTag(val3, "Enemy");
GameObject val4 = new GameObject("EmpressSwordsmachineEnemy");
val4.transform.SetParent(val3.transform, false);
val4.transform.localPosition = Vector3.zero;
val4.layer = layer;
val4.SetActive(false);
TrySetTag(val4, "Enemy");
GameObject val5 = new GameObject("Center");
val5.transform.SetParent(val4.transform, false);
val5.transform.localPosition = new Vector3(0f, 1.42f, 0f);
PhotonView val6 = val4.AddComponent<PhotonView>();
val6.Synchronization = (ViewSynchronization)3;
((Behaviour)val6).enabled = false;
CapsuleCollider val7 = val4.AddComponent<CapsuleCollider>();
val7.center = new Vector3(0f, 1.24f, 0f);
val7.height = 2.65f;
val7.radius = 0.44f;
EnemyStateSpawn stateSpawn = val4.AddComponent<EnemyStateSpawn>();
EnemyStateStunned stateStunned = val4.AddComponent<EnemyStateStunned>();
Enemy val8 = val4.AddComponent<Enemy>();
val8.Type = (EnemyType)3;
val.enemyName = "Empress Swordsmachine";
val.difficulty = (Difficulty)2;
val.actionMultiplier = 1.5f;
val.overchargeMultiplier = 1.2f;
val.EnableObject = val3;
val.SpawnedTimeMin = 1200f;
val.SpawnedTimeMax = 1800f;
val.DespawnedTimeMin = 26f;
val.DespawnedTimeMax = 44f;
RepoEnemyAccess.SetSetupDone(val, value: false);
RepoEnemyAccess.SetEnemyParentEnemy(val, val8);
RepoEnemyAccess.SetEnemyParent(val8, val);
RepoEnemyAccess.SetPhotonView(val8, val6);
val8.CenterTransform = val5.transform;
val8.KillLookAtTransform = val5.transform;
val8.CustomValuableSpawnTransform = val5.transform;
RepoEnemyAccess.SetStateSpawn(val8, stateSpawn);
RepoEnemyAccess.SetHasStateSpawn(val8, value: true);
RepoEnemyAccess.SetStateStunned(val8, stateStunned);
RepoEnemyAccess.SetHasStateStunned(val8, value: true);
RepoEnemyAccess.SetVisionMask(val8, LayerMask.op_Implicit(LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "HideTriggers" })));
val8.CurrentState = (EnemyState)1;
RepoEnemyAccess.SetTargetPlayerViewId(val8, -1);
RepoEnemyAccess.SetStateSpawnEnemy(stateSpawn, val8);
RepoEnemyAccess.SetStateStunnedEnemy(stateStunned, val8);
val4.SetActive(true);
val2.ObservedComponents = new List<Component> { (Component)(object)val };
val6.ObservedComponents = new List<Component> { (Component)(object)val8 };
SetLayerRecursively(root, layer);
TrySetTagRecursively(root, "Enemy");
}
private void BuildRuntimeInstance()
{
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Expected O, but got Unknown
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Expected O, but got Unknown
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Expected O, but got Unknown
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Expected O, but got Unknown
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Expected O, but got Unknown
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Expected O, but got Unknown
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Expected O, but got Unknown
if (!TryResolveCore(out EnemyParent enemyParent, out Enemy enemy, out EnemyStateSpawn stateSpawn, out PhotonView rootPhotonView, out PhotonView enemyPhotonView, out Transform centerTransform))
{
throw new InvalidOperationException("Empress Swordsmachine core components were not present on spawned clone.");
}
SetHideFlagsRecursively(((Component)this).transform, (HideFlags)0);
((Behaviour)rootPhotonView).enabled = true;
((Behaviour)enemyPhotonView).enabled = true;
EnemyNavMeshAgent val = EnsureRuntimeNavMeshAgent(enemy);
EmpressSwordsmachineVisual empressSwordsmachineVisual = ((Component)enemy).GetComponent<EmpressSwordsmachineVisual>() ?? ((Component)enemy).gameObject.AddComponent<EmpressSwordsmachineVisual>();
empressSwordsmachineVisual.Build();
EnemyHealth val2 = ((Component)enemy).GetComponent<EnemyHealth>() ?? ((Component)enemy).gameObject.AddComponent<EnemyHealth>();
ConfigureEnemyHealth(enemy, enemyPhotonView, val2, empressSwordsmachineVisual);
EmpressSwordsmachineAudio empressSwordsmachineAudio = ((Component)enemy).GetComponent<EmpressSwordsmachineAudio>() ?? ((Component)enemy).gameObject.AddComponent<EmpressSwordsmachineAudio>();
empressSwordsmachineAudio.Initialize();
EmpressSwordsmachineBrain empressSwordsmachineBrain = ((Component)enemy).GetComponent<EmpressSwordsmachineBrain>() ?? ((Component)enemy).gameObject.AddComponent<EmpressSwordsmachineBrain>();
empressSwordsmachineBrain.Initialize(enemyParent, enemy, val, empressSwordsmachineVisual, empressSwordsmachineAudio, centerTransform);
RepoEnemyAccess.SetEnemyParentEnemy(enemyParent, enemy);
RepoEnemyAccess.SetEnemyParent(enemy, enemyParent);
RepoEnemyAccess.SetPhotonView(enemy, enemyPhotonView);
RepoEnemyAccess.SetNavMeshAgent(enemy, val);
RepoEnemyAccess.SetHasNavMeshAgent(enemy, value: true);
RepoEnemyAccess.SetHealth(enemy, val2);
RepoEnemyAccess.SetHasHealth(enemy, value: true);
RepoEnemyAccess.SetStateSpawn(enemy, stateSpawn);
RepoEnemyAccess.SetHasStateSpawn(enemy, value: true);
RepoEnemyAccess.SetTargetPlayer(enemy, null, -1);
enemy.CenterTransform = centerTransform;
enemy.KillLookAtTransform = empressSwordsmachineVisual.HeadTransform;
enemy.CustomValuableSpawnTransform = empressSwordsmachineVisual.CoreTransform;
RepoEnemyAccess.SetStateSpawnEnemy(stateSpawn, enemy);
RepoEnemyAccess.EnsureEnemyHealthOnHurt(val2).RemoveListener(new UnityAction(empressSwordsmachineAudio.PlayHurtFeedback));
RepoEnemyAccess.EnsureEnemyHealthOnHurt(val2).AddListener(new UnityAction(empressSwordsmachineAudio.PlayHurtFeedback));
RepoEnemyAccess.EnsureEnemyHealthOnObjectHurt(val2);
RepoEnemyAccess.EnsureEnemyHealthOnDeathStart(val2).RemoveListener(new UnityAction(empressSwordsmachineBrain.HandleDeathStart));
RepoEnemyAccess.EnsureEnemyHealthOnDeathStart(val2).AddListener(new UnityAction(empressSwordsmachineBrain.HandleDeathStart));
RepoEnemyAccess.EnsureEnemyHealthOnDeath(val2).RemoveListener(new UnityAction(empressSwordsmachineBrain.HandleDeath));
RepoEnemyAccess.EnsureEnemyHealthOnDeath(val2).AddListener(new UnityAction(empressSwordsmachineBrain.HandleDeath));
stateSpawn.OnSpawn.RemoveListener(new UnityAction(empressSwordsmachineBrain.HandleSpawnEvent));
stateSpawn.OnSpawn.AddListener(new UnityAction(empressSwordsmachineBrain.HandleSpawnEvent));
rootPhotonView.ObservedComponents = new List<Component> { (Component)(object)enemyParent };
enemyPhotonView.ObservedComponents = new List<Component>
{
(Component)(object)enemy,
(Component)(object)empressSwordsmachineBrain
};
}
private bool TryResolveCore(out EnemyParent enemyParent, out Enemy enemy, out EnemyStateSpawn stateSpawn, out PhotonView rootPhotonView, out PhotonView enemyPhotonView, out Transform centerTransform)
{
enemyParent = ((Component)this).GetComponent<EnemyParent>();
rootPhotonView = ((Component)this).GetComponent<PhotonView>();
enemy = ((Component)this).GetComponentInChildren<Enemy>(true);
stateSpawn = ((Component)this).GetComponentInChildren<EnemyStateSpawn>(true);
PhotonView val = (((Object)(object)enemy != (Object)null) ? ((Component)enemy).GetComponent<PhotonView>() : null);
Transform val2 = (((Object)(object)enemy != (Object)null && (Object)(object)enemy.CenterTransform != (Object)null) ? enemy.CenterTransform : ((Component)this).transform.Find("EnableObject/EmpressSwordsmachineEnemy/Center"));
enemyPhotonView = val;
centerTransform = val2;
return (Object)(object)enemyParent != (Object)null && (Object)(object)enemy != (Object)null && (Object)(object)stateSpawn != (Object)null && (Object)(object)rootPhotonView != (Object)null && (Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null;
}
private static EnemyNavMeshAgent EnsureRuntimeNavMeshAgent(Enemy enemy)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(((Component)enemy).transform.position, ref val, 8f, -1))
{
((Component)enemy).transform.position = ((NavMeshHit)(ref val)).position;
}
NavMeshAgent val2 = ((Component)enemy).GetComponent<NavMeshAgent>() ?? ((Component)enemy).gameObject.AddComponent<NavMeshAgent>();
ConfigureNavMeshAgent(val2);
EnemyNavMeshAgent val3 = ((Component)enemy).GetComponent<EnemyNavMeshAgent>() ?? ((Component)enemy).gameObject.AddComponent<EnemyNavMeshAgent>();
val3.updateRotation = false;
((Behaviour)val3).enabled = false;
NavMeshHit val4 = default(NavMeshHit);
if (!((Behaviour)val2).enabled && NavMesh.SamplePosition(((Component)enemy).transform.position, ref val4, 6f, -1))
{
((Behaviour)val2).enabled = true;
val2.Warp(((NavMeshHit)(ref val4)).position);
}
return val3;
}
private static void ConfigureNavMeshAgent(NavMeshAgent navMeshAgent)
{
navMeshAgent.speed = 6.5f;
navMeshAgent.acceleration = 60f;
navMeshAgent.angularSpeed = 240f;
navMeshAgent.stoppingDistance = 1.15f;
navMeshAgent.radius = 0.44f;
navMeshAgent.height = 2.45f;
navMeshAgent.autoTraverseOffMeshLink = true;
navMeshAgent.obstacleAvoidanceType = (ObstacleAvoidanceType)4;
}
private static void ConfigureEnemyHealth(Enemy enemy, PhotonView enemyPhotonView, EnemyHealth health, EmpressSwordsmachineVisual visual)
{
RepoEnemyAccess.SetEnemyHealthEnemy(health, enemy);
RepoEnemyAccess.SetEnemyHealthPhotonView(health, enemyPhotonView);
RepoEnemyAccess.SetEnemyHealthMeshParent(health, visual.VisualRootTransform);
RepoEnemyAccess.SetEnemyHealthMaxHealth(health, 240);
RepoEnemyAccess.SetEnemyHealthCurrent(health, 240);
RepoEnemyAccess.SetEnemyHealthDeathFreezeTime(health, 0.08f);
RepoEnemyAccess.SetEnemyHealthImpactHurt(health, value: true);
RepoEnemyAccess.SetEnemyHealthImpactLightDamage(health, 4);
RepoEnemyAccess.SetEnemyHealthImpactMediumDamage(health, 10);
RepoEnemyAccess.SetEnemyHealthImpactHeavyDamage(health, 18);
RepoEnemyAccess.SetEnemyHealthObjectHurt(health, value: true);
RepoEnemyAccess.SetEnemyHealthObjectHurtMultiplier(health, 1f);
RepoEnemyAccess.SetEnemyHealthObjectHurtStun(health, value: true);
RepoEnemyAccess.SetEnemyHealthObjectHurtStunTime(health, 1.25f);
RepoEnemyAccess.SetEnemyHealthSpawnValuable(health, value: true);
RepoEnemyAccess.SetEnemyHealthSpawnValuableMax(health, 2);
}
private static int ResolveLayer(string layerName)
{
int num = LayerMask.NameToLayer(layerName);
return (num >= 0) ? num : 0;
}
private static void SetHideFlagsRecursively(Transform root, HideFlags hideFlags)
{
//IL_0007: 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_0024: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
((Object)((Component)root).gameObject).hideFlags = hideFlags;
foreach (Transform item in root)
{
Transform root2 = item;
SetHideFlagsRecursively(root2, hideFlags);
}
}
private static void SetLayerRecursively(Transform root, int layer)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
((Component)root).gameObject.layer = layer;
foreach (Transform item in root)
{
Transform root2 = item;
SetLayerRecursively(root2, layer);
}
}
private static void TrySetTagRecursively(Transform root, string tag)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
TrySetTag(((Component)root).gameObject, tag);
foreach (Transform item in root)
{
Transform root2 = item;
TrySetTagRecursively(root2, tag);
}
}
private static void TrySetTag(GameObject gameObject, string tag)
{
try
{
gameObject.tag = tag;
}
catch (UnityException)
{
}
}
}
internal sealed class EmpressSwordsmachineVisual : MonoBehaviour
{
private const float VisualScale = 0.86f;
private Transform _visualRoot = null;
private Transform _hips = null;
private Transform _torsoPivot = null;
private Transform _headPivot = null;
private Transform _leftArmPivot = null;
private Transform _rightArmPivot = null;
private Transform _leftLegPivot = null;
private Transform _rightLegPivot = null;
private Transform _swordPivot = null;
private Material _bodyMaterial = null;
private Material _trimMaterial = null;
private Material _eyeMaterial = null;
private Material _swordMaterial = null;
private float _stepCycle;
private float _heatLevel;
private static readonly int EmissionColorId = Shader.PropertyToID("_EmissionColor");
internal bool Ready { get; private set; }
internal Transform HeadTransform => _headPivot;
internal Transform CoreTransform => _torsoPivot;
internal Transform VisualRootTransform => _visualRoot;
internal void Build()
{
//IL_0033: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: 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_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: 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_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0306: Unknown result type (might be due to invalid IL or missing references)
//IL_031a: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Unknown result type (might be due to invalid IL or missing references)
//IL_035b: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
//IL_0409: Unknown result type (might be due to invalid IL or missing references)
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
if (!Ready)
{
int layer = ResolveLayer("Enemy");
Shader shader = ResolveShader();
_bodyMaterial = CreateMaterial(shader, new Color(0.48f, 0.49f, 0.52f), new Color(0.02f, 0.02f, 0.02f));
_trimMaterial = CreateMaterial(shader, new Color(0.15f, 0.16f, 0.18f), new Color(0f, 0f, 0f));
_eyeMaterial = CreateMaterial(shader, new Color(1f, 0.68f, 0.14f), new Color(0.7f, 0.28f, 0.02f));
_swordMaterial = CreateMaterial(shader, new Color(0.76f, 0.79f, 0.86f), new Color(0.38f, 0.14f, 0.02f));
_visualRoot = new GameObject("EmpressSwordsmachineVisualRoot").transform;
_visualRoot.SetParent(((Component)this).transform, false);
_visualRoot.localPosition = Vector3.zero;
_visualRoot.localRotation = Quaternion.identity;
_visualRoot.localScale = Vector3.one * 0.86f;
((Component)_visualRoot).gameObject.layer = layer;
_hips = CreatePivot(_visualRoot, "Hips", new Vector3(0f, 0.92f, 0f));
CreatePart(_hips, "Pelvis", (PrimitiveType)3, new Vector3(0f, 0.06f, 0f), new Vector3(0.84f, 0.32f, 0.44f), _trimMaterial, layer);
_torsoPivot = CreatePivot(_hips, "TorsoPivot", new Vector3(0f, 0.24f, 0f));
CreatePart(_torsoPivot, "Torso", (PrimitiveType)3, new Vector3(0f, 0.58f, 0f), new Vector3(0.94f, 1.12f, 0.58f), _bodyMaterial, layer);
CreatePart(_torsoPivot, "ChestPlate", (PrimitiveType)3, new Vector3(0f, 0.78f, 0.14f), new Vector3(0.7f, 0.42f, 0.1f), _trimMaterial, layer);
_headPivot = CreatePivot(_torsoPivot, "HeadPivot", new Vector3(0f, 1.08f, 0.04f));
CreatePart(_headPivot, "Head", (PrimitiveType)3, new Vector3(0f, 0.22f, 0f), new Vector3(0.56f, 0.54f, 0.54f), _bodyMaterial, layer);
CreatePart(_headPivot, "Visor", (PrimitiveType)3, new Vector3(0f, 0.2f, 0.28f), new Vector3(0.34f, 0.14f, 0.08f), _eyeMaterial, layer);
CreatePart(_headPivot, "Crest", (PrimitiveType)3, new Vector3(0f, 0.47f, -0.02f), new Vector3(0.18f, 0.18f, 0.42f), _trimMaterial, layer);
_leftArmPivot = CreatePivot(_torsoPivot, "LeftArmPivot", new Vector3(-0.56f, 0.86f, 0f));
CreateArm(_leftArmPivot, "Left", withSword: false, layer);
_rightArmPivot = CreatePivot(_torsoPivot, "RightArmPivot", new Vector3(0.56f, 0.86f, 0f));
_swordPivot = CreateArm(_rightArmPivot, "Right", withSword: true, layer);
_leftLegPivot = CreatePivot(_hips, "LeftLegPivot", new Vector3(-0.22f, -0.02f, 0f));
CreateLeg(_leftLegPivot, "Left", layer);
_rightLegPivot = CreatePivot(_hips, "RightLegPivot", new Vector3(0.22f, -0.02f, 0f));
CreateLeg(_rightLegPivot, "Right", layer);
SetLayerRecursively(_visualRoot, layer);
Ready = true;
}
}
internal void UpdatePose(EmpressSwordsmachineState state, Vector3 localVelocity, Transform? lookTarget, float attackCharge)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00aa: 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_0463: Unknown result type (might be due to invalid IL or missing references)
//IL_0474: Unknown result type (might be due to invalid IL or missing references)
//IL_048b: 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_04a9: Unknown result type (might be due to invalid IL or missing references)
//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
//IL_04de: 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_0503: Unknown result type (might be due to invalid IL or missing references)
//IL_0513: Unknown result type (might be due to invalid IL or missing references)
//IL_052a: Unknown result type (might be due to invalid IL or missing references)
//IL_0538: Unknown result type (might be due to invalid IL or missing references)
//IL_0548: Unknown result type (might be due to invalid IL or missing references)
//IL_055f: Unknown result type (might be due to invalid IL or missing references)
//IL_0570: Unknown result type (might be due to invalid IL or missing references)
//IL_0580: 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_05a8: Unknown result type (might be due to invalid IL or missing references)
//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
//IL_062e: 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_0668: Unknown result type (might be due to invalid IL or missing references)
//IL_0682: Unknown result type (might be due to invalid IL or missing references)
//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0403: Unknown result type (might be due to invalid IL or missing references)
//IL_0408: Unknown result type (might be due to invalid IL or missing references)
if (Ready)
{
Vector2 val = new Vector2(localVelocity.x, localVelocity.z);
float magnitude = ((Vector2)(ref val)).magnitude;
float num = Mathf.Clamp01(magnitude / 1.8f);
_stepCycle += Time.deltaTime * Mathf.Lerp(0.8f, 2.6f, num);
float num2 = Mathf.Sin(_stepCycle) * 11f * num;
float num3 = Mathf.Sin(_stepCycle + MathF.PI) * 11f * num;
float num4 = Mathf.Sin(_stepCycle * 2f) * 0.016f * num;
float num5 = Mathf.Clamp((0f - localVelocity.z) * 3f, -6f, 6f);
float num6 = Mathf.Clamp((0f - localVelocity.x) * 4f, -8f, 8f);
float num7 = 0f;
float num8 = 0f;
float num9 = num2 * 0.4f;
float num10 = -30f + num3 * 0.2f;
float num11 = 10f;
float num12 = -8f;
float num13 = num3;
float num14 = num2;
float num15 = 0f;
float num16 = 0.12f;
switch (state)
{
case EmpressSwordsmachineState.SpawnIntro:
num5 -= 18f * (1f - attackCharge);
num7 += 6f;
num10 = -70f + attackCharge * 18f;
num11 = 14f;
num15 = -10f;
num16 = 0.35f + attackCharge * 0.15f;
break;
case EmpressSwordsmachineState.Hunt:
num5 += 4f;
num10 = -32f;
num11 = 12f;
num15 = -6f;
num16 = 0.22f;
break;
case EmpressSwordsmachineState.Windup:
num5 -= 14f;
num7 -= 4f;
num9 = 18f;
num12 = -16f;
num10 = -142f;
num11 = 22f;
num13 = -16f;
num14 = 10f;
num15 = -16f;
num16 = 0.6f + attackCharge * 0.4f;
break;
case EmpressSwordsmachineState.Dash:
num5 = 14f;
num6 = Mathf.Clamp(num6, -6f, 6f);
num7 -= 2f;
num9 = -18f;
num12 = -10f;
num10 = -128f;
num11 = 18f;
num13 = -14f;
num14 = 16f;
num15 = -14f;
num16 = 0.9f;
break;
case EmpressSwordsmachineState.Slam:
num5 = 22f;
num7 = 12f;
num9 = 18f;
num12 = -16f;
num10 = 18f;
num11 = 10f;
num13 = 12f;
num14 = -18f;
num15 = 108f;
num16 = 1f;
break;
case EmpressSwordsmachineState.Recover:
num5 -= 10f;
num7 += 4f;
num9 = 22f;
num10 = 24f;
num11 = -4f;
num15 = 28f;
num16 = 0.32f;
break;
case EmpressSwordsmachineState.Reposition:
num5 += 2f;
num10 = -26f;
num11 = 12f;
num15 = -8f;
num16 = 0.18f;
break;
case EmpressSwordsmachineState.Stunned:
num5 = 34f;
num6 = Mathf.Sin(Time.time * 10f) * 4f;
num7 = 22f;
num9 = 72f;
num12 = -22f;
num10 = 94f;
num11 = 8f;
num13 = -16f;
num14 = 14f;
num15 = 32f;
num16 = 0.05f;
break;
}
if ((Object)(object)lookTarget != (Object)null)
{
Vector3 val2 = _torsoPivot.InverseTransformPoint(lookTarget.position);
float num17 = Mathf.Atan2(val2.x, val2.z) * 57.29578f;
float y = val2.y;
val = new Vector2(val2.x, val2.z);
float num18 = (0f - Mathf.Atan2(y, Mathf.Max(0.001f, ((Vector2)(ref val)).magnitude))) * 57.29578f;
num8 += Mathf.Clamp(num17, -42f, 42f);
num7 += Mathf.Clamp(num18, -22f, 18f);
}
_visualRoot.localPosition = new Vector3(0f, num4, 0f);
_hips.localRotation = Quaternion.identity;
_torsoPivot.localRotation = Quaternion.Slerp(_torsoPivot.localRotation, Quaternion.Euler(num5, 0f, num6), Time.deltaTime * 12f);
_headPivot.localRotation = Quaternion.Slerp(_headPivot.localRotation, Quaternion.Euler(num7, num8, 0f), Time.deltaTime * 15f);
_leftArmPivot.localRotation = Quaternion.Slerp(_leftArmPivot.localRotation, Quaternion.Euler(num9, num12, 0f), Time.deltaTime * 14f);
_rightArmPivot.localRotation = Quaternion.Slerp(_rightArmPivot.localRotation, Quaternion.Euler(num10, num11, 0f), Time.deltaTime * 14f);
_leftLegPivot.localRotation = Quaternion.Slerp(_leftLegPivot.localRotation, Quaternion.Euler(num13, 0f, 0f), Time.deltaTime * 14f);
_rightLegPivot.localRotation = Quaternion.Slerp(_rightLegPivot.localRotation, Quaternion.Euler(num14, 0f, 0f), Time.deltaTime * 14f);
_swordPivot.localRotation = Quaternion.Slerp(_swordPivot.localRotation, Quaternion.Euler(num15, 0f, 0f), Time.deltaTime * 18f);
_heatLevel = Mathf.Lerp(_heatLevel, num16, Time.deltaTime * 8f);
SetEmission(_eyeMaterial, new Color(0.9f, 0.36f, 0.08f) * Mathf.Lerp(0.15f, 1.8f, _heatLevel));
SetEmission(_swordMaterial, new Color(1f, 0.4f, 0.08f) * Mathf.Lerp(0.1f, 2.3f, _heatLevel));
}
}
internal void TriggerGroundSlam(Vector3 worldPosition, float radius)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_0087: 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)
//IL_0060: 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_0074: Unknown result type (might be due to invalid IL or missing references)
if (Ready)
{
Vector3 position = worldPosition;
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(worldPosition + Vector3.up * 3f, Vector3.down, ref val, 8f, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1))
{
position = ((RaycastHit)(ref val)).point + Vector3.up * 0.03f;
}
GameObject val2 = new GameObject("EmpressSwordsmachineGroundSlam");
val2.transform.position = position;
EmpressSwordsmachineGroundSlamEffect empressSwordsmachineGroundSlamEffect = val2.AddComponent<EmpressSwordsmachineGroundSlamEffect>();
empressSwordsmachineGroundSlamEffect.Initialize(radius);
}
}
private Transform CreateArm(Transform parent, string side, bool withSword, int layer)
{
//IL_001d: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: 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_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: 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_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
CreatePart(parent, side + "UpperArm", (PrimitiveType)1, new Vector3(0f, -0.36f, 0f), new Vector3(0.22f, 0.48f, 0.22f), _bodyMaterial, layer);
Transform parent2 = CreatePivot(parent, side + "ForearmPivot", new Vector3(0f, -0.72f, 0f));
CreatePart(parent2, side + "Forearm", (PrimitiveType)1, new Vector3(0f, -0.28f, 0f), new Vector3(0.18f, 0.42f, 0.18f), _trimMaterial, layer);
Transform val = CreatePivot(parent2, side + "HandPivot", new Vector3(0f, -0.56f, 0f));
CreatePart(val, side + "Hand", (PrimitiveType)3, new Vector3(0f, -0.05f, 0f), new Vector3(0.18f, 0.18f, 0.18f), _trimMaterial, layer);
if (!withSword)
{
return val;
}
Transform val2 = CreatePivot(val, side + "SwordPivot", new Vector3(0f, -0.02f, 0.1f));
CreatePart(val2, side + "Guard", (PrimitiveType)3, new Vector3(0f, 0f, 0.1f), new Vector3(0.42f, 0.08f, 0.12f), _eyeMaterial, layer);
CreatePart(val2, side + "Handle", (PrimitiveType)3, new Vector3(0f, 0f, 0.18f), new Vector3(0.08f, 0.08f, 0.26f), _trimMaterial, layer);
CreatePart(val2, side + "Blade", (PrimitiveType)3, new Vector3(0f, 0f, 1.16f), new Vector3(0.08f, 0.16f, 2f), _swordMaterial, layer);
return val2;
}
private void CreateLeg(Transform parent, string side, int layer)
{
//IL_001d: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_00db: Unknown result type (might be due to invalid IL or missing references)
CreatePart(parent, side + "Thigh", (PrimitiveType)1, new Vector3(0f, -0.42f, 0f), new Vector3(0.24f, 0.62f, 0.24f), _bodyMaterial, layer);
Transform parent2 = CreatePivot(parent, side + "CalfPivot", new Vector3(0f, -0.82f, 0f));
CreatePart(parent2, side + "Calf", (PrimitiveType)1, new Vector3(0f, -0.34f, 0f), new Vector3(0.2f, 0.54f, 0.2f), _trimMaterial, layer);
CreatePart(parent2, side + "Foot", (PrimitiveType)3, new Vector3(0f, -0.72f, 0.16f), new Vector3(0.24f, 0.12f, 0.46f), _trimMaterial, layer);
}
private static Transform CreatePivot(Transform parent, string name, Vector3 localPosition)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_001c: 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)
GameObject val = new GameObject(name);
val.transform.SetParent(parent, false);
val.transform.localPosition = localPosition;
val.transform.localRotation = Quaternion.identity;
return val.transform;
}
private static Transform CreatePart(Transform parent, string name, PrimitiveType primitiveType, Vector3 localPosition, Vector3 localScale, Material material, int layer)
{
//IL_0001: 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_0031: 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)
GameObject val = GameObject.CreatePrimitive(primitiveType);
((Object)val).name = name;
val.transform.SetParent(parent, false);
val.transform.localPosition = localPosition;
val.transform.localRotation = Quaternion.identity;
val.transform.localScale = localScale;
val.layer = layer;
Collider component = val.GetComponent<Collider>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
MeshRenderer component2 = val.GetComponent<MeshRenderer>();
if ((Object)(object)component2 != (Object)null)
{
((Renderer)component2).sharedMaterial = material;
}
return val.transform;
}
private static Shader ResolveShader()
{
return Shader.Find("Standard") ?? Shader.Find("Universal Render Pipeline/Lit") ?? Shader.Find("Legacy Shaders/Diffuse") ?? Shader.Find("Sprites/Default");
}
private static Material CreateMaterial(Shader shader, Color color, Color emission)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
Material val = new Material(shader)
{
color = color
};
if (val.HasProperty("_Glossiness"))
{
val.SetFloat("_Glossiness", 0.12f);
}
if (val.HasProperty(EmissionColorId))
{
val.EnableKeyword("_EMISSION");
val.SetColor(EmissionColorId, emission);
}
return val;
}
private static void SetEmission(Material material, Color emission)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if (material.HasProperty(EmissionColorId))
{
material.EnableKeyword("_EMISSION");
material.SetColor(EmissionColorId, emission);
}
}
private static int ResolveLayer(string layerName)
{
int num = LayerMask.NameToLayer(layerName);
return (num >= 0) ? num : 0;
}
private static void SetLayerRecursively(Transform root, int layer)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
((Component)root).gameObject.layer = layer;
foreach (Transform item in root)
{
Transform root2 = item;
SetLayerRecursively(root2, layer);
}
}
}
internal sealed class EmpressSwordsmachineGroundSlamEffect : MonoBehaviour
{
private Transform _pulseDisc = null;
private Transform _ring = null;
private Material _pulseMaterial = null;
private Material _ringMaterial = null;
private float _radius;
private float _timer;
private float _lifetime;
private static readonly int