using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.AI;
[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Thalas")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2")]
[assembly: AssemblyProduct("Gnoelma")]
[assembly: AssemblyTitle("Gnoelma")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.2.0")]
[module: UnverifiableCode]
[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;
}
}
}
public class EnemyGnoelma : EnemyGnome
{
private void Awake()
{
base.photonView = ((Component)this).GetComponent<PhotonView>();
Debug.Log((object)"GNOELMASSSS");
}
private void Start()
{
base.enemy.NavMeshAgent.DefaultSpeed = Random.Range(base.speedMin, base.speedMax);
base.enemy.NavMeshAgent.Agent.speed = base.enemy.NavMeshAgent.DefaultSpeed;
}
private void Update()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Invalid comparison between Unknown and I4
//IL_0085: 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_008c: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Expected I4, but got Unknown
if (Object.op_Implicit((Object)(object)EnemyGnoelmaDirector.instance) && EnemyGnoelmaDirector.instance.setup && SemiFunc.IsMasterClientOrSingleplayer())
{
AvoidLogic();
RotationLogic();
BackAwayOffsetLogic();
MoveOffsetLogic();
TimerLogic();
if ((int)base.enemy.CurrentState == 11)
{
UpdateState((State)12);
}
if (base.enemy.IsStunned())
{
UpdateState((State)11);
}
State currentState = base.currentState;
State val = currentState;
switch ((int)val)
{
case 0:
StateSpawn();
break;
case 1:
StateIdle();
break;
case 4:
StateMove();
break;
case 3:
StateNotice();
break;
case 2:
StateNoticeDelay();
break;
case 5:
StateMoveUnder();
break;
case 6:
StateMoveOver();
break;
case 7:
StateMoveBack();
break;
case 8:
StateAttackMove();
break;
case 9:
StateAttack();
break;
case 10:
StateAttackDone();
break;
case 11:
StateStun();
break;
case 12:
StateDespawn();
break;
}
}
}
private void FixedUpdate()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer() && base.avoidForce != Vector3.zero)
{
base.enemy.Rigidbody.rb.AddForce(base.avoidForce * 2f, (ForceMode)0);
}
}
private void StateSpawn()
{
if (base.stateImpulse)
{
base.stateImpulse = false;
base.stateTimer = 1f;
}
base.stateTimer -= Time.deltaTime;
if (base.stateTimer <= 0f)
{
UpdateState((State)1);
}
}
private void StateIdle()
{
//IL_0038: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
if (base.stateImpulse)
{
base.enemy.NavMeshAgent.ResetPath();
base.enemy.NavMeshAgent.Warp(((Component)base.enemy.Rigidbody).transform.position);
base.stateImpulse = false;
}
base.enemy.Rigidbody.DisableFollowPosition(0.1f, 0.5f);
IdleBreakerLogic();
if (EnemyGnoelmaDirector.instance.currentState == EnemyGnoelmaDirector.State.AttackPlayer || EnemyGnoelmaDirector.instance.currentState == EnemyGnoelmaDirector.State.AttackValuable)
{
UpdateState((State)2);
}
else if (Vector3.Distance(((Component)base.enemy.Rigidbody).transform.position, EnemyGnoelmaDirector.instance.destinations[base.directorIndex]) > 2f)
{
UpdateState((State)4);
}
}
private void StateMove()
{
//IL_003a: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
if (base.stateImpulse)
{
base.stateImpulse = false;
base.stateTimer = 2f;
}
base.enemy.NavMeshAgent.SetDestination(EnemyGnoelmaDirector.instance.destinations[base.directorIndex]);
MoveBackPosition();
MoveOffsetSet();
SemiFunc.EnemyCartJump(base.enemy);
if (EnemyGnoelmaDirector.instance.currentState == EnemyGnoelmaDirector.State.AttackPlayer || EnemyGnoelmaDirector.instance.currentState == EnemyGnoelmaDirector.State.AttackValuable)
{
UpdateState((State)2);
}
else if (Vector3.Distance(((Component)base.enemy.Rigidbody).transform.position, EnemyGnoelmaDirector.instance.destinations[base.directorIndex]) <= 0.2f)
{
UpdateState((State)1);
}
else if (Vector3.Distance(((Component)base.enemy.Rigidbody).transform.position, EnemyGnoelmaDirector.instance.destinations[base.directorIndex]) <= 2f)
{
base.stateTimer -= Time.deltaTime;
if (base.stateTimer <= 0f)
{
UpdateState((State)1);
}
}
}
private void StateNoticeDelay()
{
if (base.stateImpulse)
{
base.stateImpulse = false;
base.stateTimer = Random.Range(0f, 1f);
}
base.stateTimer -= Time.deltaTime;
if (base.stateTimer <= 0f)
{
UpdateState((State)3);
}
}
private void StateNotice()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
if (base.stateImpulse)
{
base.enemy.NavMeshAgent.ResetPath();
base.enemy.NavMeshAgent.Warp(((Component)base.enemy.Rigidbody).transform.position);
base.stateImpulse = false;
base.stateTimer = 0.5f;
}
base.stateTimer -= Time.deltaTime;
if (base.stateTimer <= 0f)
{
UpdateState((State)8);
}
}
private void StateAttackMove()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: 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_00e9: 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)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: 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_0209: Unknown result type (might be due to invalid IL or missing references)
if (base.stateImpulse)
{
base.stateImpulse = false;
}
base.stateTimer -= Time.deltaTime;
Vector3 destination = AttackPositionLogic();
base.enemy.NavMeshAgent.SetDestination(destination);
bool flag = EnemyGnoelmaDirector.instance.CanAttack(this);
MoveBackPosition();
MoveOffsetSet();
SemiFunc.EnemyCartJump(base.enemy);
if (EnemyGnoelmaDirector.instance.currentState != EnemyGnoelmaDirector.State.AttackPlayer && EnemyGnoelmaDirector.instance.currentState != EnemyGnoelmaDirector.State.AttackValuable)
{
UpdateState((State)4);
}
else if (flag)
{
SemiFunc.EnemyCartJumpReset(base.enemy);
UpdateState((State)9);
}
else
{
if (base.enemy.NavMeshAgent.CanReach(AttackVisionDynamic(), 1f) || !(Vector3.Distance(((Component)base.enemy.Rigidbody).transform.position, base.enemy.NavMeshAgent.GetPoint()) < 2f))
{
return;
}
if (AttackPositionLogic().y > ((Component)base.enemy.Rigidbody).transform.position.y + 0.2f)
{
base.enemy.Jump.StuckTrigger(AttackVisionPosition() - base.enemy.Vision.VisionTransform.position);
}
NavMeshHit val = default(NavMeshHit);
if (!VisionBlocked() && !NavMesh.SamplePosition(AttackVisionDynamic(), ref val, 0.5f, -1))
{
if (Mathf.Abs(AttackVisionDynamic().y - ((Component)base.enemy.Rigidbody).transform.position.y) < 0.2f)
{
UpdateState((State)5);
}
else if (AttackPositionLogic().y > ((Component)base.enemy.Rigidbody).transform.position.y)
{
UpdateState((State)6);
}
}
}
}
private void StateMoveUnder()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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)
if (base.stateImpulse)
{
base.stateTimer = 2f;
base.stateImpulse = false;
}
bool flag = EnemyGnoelmaDirector.instance.CanAttack(this);
Vector3 val = AttackPositionLogic();
base.enemy.NavMeshAgent.Disable(0.1f);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, val, base.enemy.NavMeshAgent.DefaultSpeed * Time.deltaTime);
MoveOffsetSet();
SemiFunc.EnemyCartJump(base.enemy);
NavMeshHit val2 = default(NavMeshHit);
if (EnemyGnoelmaDirector.instance.currentState != EnemyGnoelmaDirector.State.AttackPlayer && EnemyGnoelmaDirector.instance.currentState != EnemyGnoelmaDirector.State.AttackValuable)
{
UpdateState((State)7);
}
else if (flag)
{
SemiFunc.EnemyCartJumpReset(base.enemy);
UpdateState((State)9);
}
else if (NavMesh.SamplePosition(val, ref val2, 0.5f, -1))
{
UpdateState((State)7);
}
else if (VisionBlocked())
{
base.stateTimer -= Time.deltaTime;
if (base.stateTimer <= 0f)
{
UpdateState((State)7);
}
}
else
{
EnemyGnoelmaDirector.instance.SeeTarget();
base.stateTimer = 2f;
}
}
private void StateMoveOver()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: 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_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
if (base.stateImpulse)
{
base.stateTimer = 2f;
base.stateImpulse = false;
}
bool flag = EnemyGnoelmaDirector.instance.CanAttack(this);
Vector3 val = AttackPositionLogic();
base.enemy.NavMeshAgent.Disable(0.1f);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, val, base.enemy.NavMeshAgent.DefaultSpeed * Time.deltaTime);
MoveOffsetSet();
SemiFunc.EnemyCartJump(base.enemy);
if (AttackVisionDynamic().y > ((Component)base.enemy.Rigidbody).transform.position.y + 0.2f && !flag)
{
base.enemy.Jump.StuckTrigger(AttackVisionDynamic() - ((Component)base.enemy.Rigidbody).transform.position);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, AttackVisionDynamic(), 2f);
}
NavMeshHit val2 = default(NavMeshHit);
if (EnemyGnoelmaDirector.instance.currentState != EnemyGnoelmaDirector.State.AttackPlayer && EnemyGnoelmaDirector.instance.currentState != EnemyGnoelmaDirector.State.AttackValuable)
{
UpdateState((State)7);
}
else if (flag)
{
SemiFunc.EnemyCartJumpReset(base.enemy);
UpdateState((State)9);
}
else if (NavMesh.SamplePosition(val, ref val2, 0.5f, -1))
{
UpdateState((State)7);
}
else if (VisionBlocked())
{
base.stateTimer -= Time.deltaTime;
if (base.stateTimer <= 0f)
{
UpdateState((State)7);
}
}
else
{
EnemyGnoelmaDirector.instance.SeeTarget();
base.stateTimer = 2f;
}
}
private void StateMoveBack()
{
//IL_0059: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: 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_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
if (base.stateImpulse)
{
base.stateImpulse = false;
base.stateTimer = 2f;
}
base.enemy.NavMeshAgent.Disable(0.1f);
if (!base.enemy.Jump.jumping)
{
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, base.moveBackPosition, base.enemy.NavMeshAgent.DefaultSpeed * Time.deltaTime);
}
MoveOffsetSet();
SemiFunc.EnemyCartJump(base.enemy);
base.stateTimer -= Time.deltaTime;
bool flag = EnemyGnoelmaDirector.instance.CanAttack(this);
if (base.stateTimer <= 0f && (Vector3.Distance(((Component)this).transform.position, ((Component)base.enemy.Rigidbody).transform.position) > 2f || base.enemy.Rigidbody.notMovingTimer > 2f) && !base.enemy.Jump.jumping)
{
Vector3 val = ((Component)this).transform.position - base.moveBackPosition;
Vector3 normalized = ((Vector3)(ref val)).normalized;
base.enemy.Jump.StuckTrigger(((Component)this).transform.position - base.moveBackPosition);
((Component)this).transform.position = ((Component)base.enemy.Rigidbody).transform.position;
Transform transform = ((Component)this).transform;
transform.position += normalized * 2f;
}
NavMeshHit val2 = default(NavMeshHit);
if (flag)
{
SemiFunc.EnemyCartJumpReset(base.enemy);
UpdateState((State)9);
}
else if (Vector3.Distance(((Component)base.enemy.Rigidbody).transform.position, base.moveBackPosition) <= 0.2f)
{
UpdateState((State)8);
}
else if (NavMesh.SamplePosition(((Component)base.enemy.Rigidbody).transform.position, ref val2, 0.5f, -1))
{
UpdateState((State)8);
}
}
private void StateAttack()
{
//IL_0038: 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 (base.stateImpulse)
{
base.enemy.NavMeshAgent.ResetPath();
base.enemy.NavMeshAgent.Warp(((Component)base.enemy.Rigidbody).transform.position);
base.stateTimer = 3f;
base.stateImpulse = false;
}
if (base.stateTimer > 0.5f)
{
AnimatorStateInfo currentAnimatorStateInfo = base.enemyGnomeAnim.animator.GetCurrentAnimatorStateInfo(0);
if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Attack"))
{
UpdateState((State)8);
return;
}
}
base.enemy.StuckCount = 0;
base.enemy.Rigidbody.DisableFollowPosition(0.1f, 1f);
base.stateTimer -= Time.deltaTime;
if (base.stateTimer <= 0f)
{
UpdateState((State)10);
}
}
private void StateAttackDone()
{
//IL_0093: 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)
if (base.stateImpulse)
{
base.stateTimer = 1f;
base.stateImpulse = false;
}
base.enemy.StuckCount = 0;
base.enemy.Rigidbody.DisableFollowPosition(0.1f, 5f);
base.stateTimer -= Time.deltaTime;
if (base.stateTimer <= 0f)
{
base.moveBackTimer = 2f;
base.attackCooldown = 2f;
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(((Component)base.enemy.Rigidbody).transform.position, ref val, 0.5f, -1))
{
UpdateState((State)8);
}
else
{
UpdateState(base.attackMoveState);
}
}
}
private void StateStun()
{
if (base.stateImpulse)
{
base.stateImpulse = false;
}
if (!base.enemy.IsStunned())
{
UpdateState((State)1);
}
}
private void StateDespawn()
{
if (base.stateImpulse)
{
base.stateImpulse = false;
}
}
public void OnSpawn()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(base.enemy))
{
EnemyGnoelmaDirector.instance.OnSpawn();
UpdateState((State)0);
}
}
public void OnHurt()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
base.soundHurt.Play(base.enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
public void OnDeath()
{
//IL_0012: 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_0089: Unknown result type (might be due to invalid IL or missing references)
base.soundDeath.Play(base.enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
GameDirector.instance.CameraShake.ShakeDistance(3f, 3f, 10f, base.enemy.CenterTransform.position, 0.5f);
GameDirector.instance.CameraImpact.ShakeDistance(3f, 3f, 10f, base.enemy.CenterTransform.position, 0.05f);
ParticleSystem[] deathEffects = base.deathEffects;
for (int i = 0; i < deathEffects.Length; i++)
{
deathEffects[i].Play();
}
if (SemiFunc.IsMasterClientOrSingleplayer())
{
base.enemy.EnemyParent.Despawn();
}
}
public void OnInvestigate()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer())
{
EnemyGnoelmaDirector.instance.Investigate(base.enemy.StateInvestigate.onInvestigateTriggeredPosition);
}
}
public void OnVision()
{
if (SemiFunc.IsMasterClientOrSingleplayer())
{
EnemyGnoelmaDirector.instance.SetTarget(base.enemy.Vision.onVisionTriggeredPlayer);
}
}
public void OnImpactLight()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (base.enemy.IsStunned())
{
base.soundImpactLight.Play(base.enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
}
public void OnImpactMedium()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (base.enemy.IsStunned())
{
base.soundImpactMedium.Play(base.enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
}
public void OnImpactHeavy()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (base.enemy.IsStunned())
{
base.soundImpactHeavy.Play(base.enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
}
}
public void UpdateState(State _state)
{
//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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
if (base.currentState != _state)
{
if ((int)_state == 9)
{
base.attackMoveState = base.currentState;
}
base.currentState = _state;
base.stateImpulse = true;
base.stateTimer = 0f;
if (GameManager.Multiplayer())
{
base.photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { base.currentState });
}
else
{
UpdateStateRPC(base.currentState);
}
}
}
private void RotationLogic()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Invalid comparison between Unknown and I4
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between Unknown and I4
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Invalid comparison between Unknown and I4
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Invalid comparison between Unknown and I4
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Invalid comparison between Unknown and I4
//IL_008a: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Invalid comparison between Unknown and I4
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Invalid comparison between Unknown and I4
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: 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_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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_00e5: 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_0110: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Invalid comparison between Unknown and I4
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: 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_0078: Invalid comparison between Unknown and I4
if ((int)base.currentState == 4 || (int)base.currentState == 3 || (int)base.currentState == 8 || (int)base.currentState == 5 || (int)base.currentState == 6 || (int)base.currentState == 7 || (int)base.currentState == 9)
{
if ((int)base.currentState == 3 || (((int)base.currentState == 8 || (int)base.currentState == 5 || (int)base.currentState == 6 || (int)base.currentState == 9) && Vector3.Distance(((Component)base.enemy.Rigidbody).transform.position, EnemyGnoelmaDirector.instance.attackPosition) < 5f))
{
Quaternion rotation = base.rotationTransform.rotation;
base.rotationTransform.rotation = Quaternion.LookRotation(AttackVisionPosition() - ((Component)base.enemy.Rigidbody).transform.position);
base.rotationTransform.eulerAngles = new Vector3(0f, base.rotationTransform.eulerAngles.y, 0f);
Quaternion rotation2 = base.rotationTransform.rotation;
base.rotationTransform.rotation = rotation;
base.rotationTarget = rotation2;
}
else
{
Vector3 velocity = base.enemy.Rigidbody.rb.velocity;
if (((Vector3)(ref velocity)).magnitude > 0.1f)
{
Vector3 position = base.rotationTransform.position;
Quaternion rotation3 = base.rotationTransform.rotation;
base.rotationTransform.position = ((Component)base.enemy.Rigidbody).transform.position;
Transform rotationTransform = base.rotationTransform;
velocity = base.enemy.Rigidbody.rb.velocity;
rotationTransform.rotation = Quaternion.LookRotation(((Vector3)(ref velocity)).normalized);
base.rotationTransform.eulerAngles = new Vector3(0f, base.rotationTransform.eulerAngles.y, 0f);
Quaternion rotation4 = base.rotationTransform.rotation;
base.rotationTransform.position = position;
base.rotationTransform.rotation = rotation3;
base.rotationTarget = rotation4;
}
}
}
else if ((int)base.currentState == 1 && Vector3.Distance(((Component)EnemyGnoelmaDirector.instance).transform.position, ((Component)base.enemy.Rigidbody).transform.position) > 0.1f)
{
Quaternion rotation5 = base.rotationTransform.rotation;
base.rotationTransform.rotation = Quaternion.LookRotation(((Component)EnemyGnoelmaDirector.instance).transform.position - ((Component)base.enemy.Rigidbody).transform.position);
base.rotationTransform.eulerAngles = new Vector3(0f, base.rotationTransform.eulerAngles.y, 0f);
Quaternion rotation6 = base.rotationTransform.rotation;
base.rotationTransform.rotation = rotation5;
base.rotationTarget = rotation6;
}
base.rotationTransform.rotation = SemiFunc.SpringQuaternionGet(base.rotationSpring, base.rotationTarget, -1f);
}
private void AvoidLogic()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Invalid comparison between Unknown and I4
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
if ((int)base.currentState == 4 || (int)base.currentState == 8 || (int)base.currentState == 5 || (int)base.currentState == 6)
{
if (base.avoidTimer <= 0f)
{
base.avoidForce = Vector3.zero;
base.avoidTimer = 0.25f;
if (base.enemy.Jump.jumping)
{
return;
}
Collider[] array = Physics.OverlapBox(((Component)base.avoidCollider).transform.position, base.avoidCollider.size / 2f, ((Component)base.avoidCollider).transform.rotation, LayerMask.GetMask(new string[1] { "PhysGrabObject" }));
for (int i = 0; i < array.Length; i++)
{
EnemyRigidbody componentInParent = ((Component)array[i]).GetComponentInParent<EnemyRigidbody>();
if (Object.op_Implicit((Object)(object)componentInParent))
{
EnemyGnoelma component = ((Component)componentInParent.enemy).GetComponent<EnemyGnoelma>();
if (Object.op_Implicit((Object)(object)component))
{
Vector3 avoidForce = base.avoidForce;
Vector3 val = ((Component)this).transform.position - ((Component)component).transform.position;
val = ((Vector3)(ref val)).normalized;
base.avoidForce = avoidForce + ((Vector3)(ref val)).normalized;
}
}
}
}
else
{
base.avoidTimer -= Time.deltaTime;
}
}
else
{
base.avoidForce = Vector3.zero;
}
}
private Vector3 AttackPositionLogic()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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_0054: 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)
Vector3 result = EnemyGnoelmaDirector.instance.attackPosition + new Vector3(Mathf.Cos(base.attackAngle), 0f, Mathf.Sin(base.attackAngle)) * 0.7f;
base.attackAngle += Time.deltaTime * 1f;
return result;
}
private Vector3 AttackVisionPosition()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
return EnemyGnoelmaDirector.instance.attackVisionPosition;
}
private Vector3 AttackVisionDynamic()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0025: Unknown result type (might be due to invalid IL or missing references)
if (EnemyGnoelmaDirector.instance.currentState == EnemyGnoelmaDirector.State.AttackPlayer)
{
return AttackPositionLogic();
}
return AttackVisionPosition();
}
private void MoveBackPosition()
{
//IL_0007: 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_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)
if (Vector3.Distance(((Component)this).transform.position, ((Component)base.enemy.Rigidbody).transform.position) < 1f)
{
base.moveBackPosition = ((Component)this).transform.position;
}
}
private void BackAwayOffsetLogic()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_0031: 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_0055: Unknown result type (might be due to invalid IL or missing references)
if (base.moveBackTimer > 0f)
{
base.moveBackTimer -= Time.deltaTime;
base.backAwayOffset.localPosition = Vector3.Lerp(base.backAwayOffset.localPosition, new Vector3(0f, 0f, -1f), Time.deltaTime * 10f);
}
else
{
base.backAwayOffset.localPosition = Vector3.Lerp(base.backAwayOffset.localPosition, Vector3.zero, Time.deltaTime * 10f);
}
}
private void MoveOffsetLogic()
{
//IL_00dd: 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_00f3: 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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: 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)
if (base.moveOffsetTimer > 0f)
{
base.moveOffsetTimer -= Time.deltaTime;
if (base.enemy.Jump.jumping)
{
base.moveOffsetTimer = 0f;
}
if (base.moveOffsetTimer <= 0f)
{
base.moveOffsetPosition = Vector3.zero;
}
else
{
base.moveOffsetSetTimer -= Time.deltaTime;
if (base.moveOffsetSetTimer <= 0f)
{
Vector3 moveOffsetPosition = Random.insideUnitSphere * 0.5f;
moveOffsetPosition.y = 0f;
base.moveOffsetPosition = moveOffsetPosition;
base.moveOffsetSetTimer = Random.Range(0.2f, 1f);
}
}
}
base.moveOffsetTransform.localPosition = Vector3.Lerp(base.moveOffsetTransform.localPosition, base.moveOffsetPosition, Time.deltaTime * 20f);
}
private void MoveOffsetSet()
{
base.moveOffsetTimer = 0.2f;
}
private bool VisionBlocked()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
if (base.visionTimer <= 0f)
{
base.visionTimer = 0.1f;
Vector3 val = AttackVisionPosition() - base.enemy.Vision.VisionTransform.position;
base.visionPrevious = Physics.Raycast(base.enemy.Vision.VisionTransform.position, val, ((Vector3)(ref val)).magnitude, LayerMask.GetMask(new string[1] { "Default" }));
}
return base.visionPrevious;
}
private void TimerLogic()
{
base.visionTimer -= Time.deltaTime;
base.attackCooldown -= Time.deltaTime;
base.overlapCheckTimer -= Time.deltaTime;
if (base.overlapCheckCooldown > 0f)
{
base.overlapCheckCooldown -= Time.deltaTime;
if (base.overlapCheckCooldown <= 0f)
{
base.overlapCheckPrevious = false;
}
}
}
public void IdleBreakerLogic()
{
//IL_002e: 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)
bool flag = false;
foreach (EnemyGnoelma gnoelma in EnemyGnoelmaDirector.instance.gnoelmas)
{
if ((Object)(object)gnoelma != (Object)(object)this && Vector3.Distance(((Component)this).transform.position, ((Component)gnoelma).transform.position) < 2f)
{
flag = true;
break;
}
}
if (!flag)
{
return;
}
if (base.idleBreakerTimer <= 0f)
{
base.idleBreakerTimer = Random.Range(2f, 15f);
if (SemiFunc.IsMultiplayer())
{
base.photonView.RPC("IdleBreakerRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
IdleBreakerRPC();
}
}
else
{
base.idleBreakerTimer -= Time.deltaTime;
}
}
[PunRPC]
private void UpdateStateRPC(State _state)
{
//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_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
base.currentState = _state;
if ((int)base.currentState == 0)
{
base.enemyGnomeAnim.OnSpawn();
}
}
[PunRPC]
private void IdleBreakerRPC()
{
base.enemyGnomeAnim.idleBreakerImpulse = true;
}
}
public class EnemyGnoelmaDirector : MonoBehaviour
{
public enum State
{
Idle,
Leave,
ChangeDestination,
Investigate,
AttackSet,
AttackPlayer,
AttackValuable
}
[CompilerGenerated]
private sealed class <Setup>d__18 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public EnemyGnoelmaDirector <>4__this;
private List<EnemyParent>.Enumerator <>s__1;
private EnemyParent <item>5__2;
private EnemyGnoelma <component>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Setup>d__18(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__1 = default(List<EnemyParent>.Enumerator);
<item>5__2 = null;
<component>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if (!LevelGenerator.Instance.Generated)
{
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
}
<>s__1 = EnemyDirector.instance.enemiesSpawned.GetEnumerator();
try
{
while (<>s__1.MoveNext())
{
<item>5__2 = <>s__1.Current;
<component>5__3 = ((Component)<item>5__2.Enemy).GetComponent<EnemyGnoelma>();
if (Object.op_Implicit((Object)(object)<component>5__3))
{
if (<>4__this.debugOneOnly && <>4__this.gnoelmas.Count > 0)
{
Object.Destroy((Object)(object)((Component)((EnemyGnome)<component>5__3).enemy.EnemyParent).gameObject);
continue;
}
<>4__this.gnoelmas.Add(<component>5__3);
<>4__this.destinations.Add(Vector3.zero);
((EnemyGnome)<component>5__3).directorIndex = <>4__this.gnoelmas.IndexOf(<component>5__3);
}
<component>5__3 = null;
<item>5__2 = null;
}
}
finally
{
((IDisposable)<>s__1).Dispose();
}
<>s__1 = default(List<EnemyParent>.Enumerator);
<>4__this.setup = true;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static EnemyGnoelmaDirector instance;
public bool debugDraw;
public bool debugOneOnly;
public bool debugShortIdle;
public bool debugLongIdle;
[Space]
public List<EnemyGnoelma> gnoelmas = new List<EnemyGnoelma>();
internal List<Vector3> destinations = new List<Vector3>();
[Space]
public State currentState = State.ChangeDestination;
private bool stateImpulse = true;
private float stateTimer;
internal bool setup;
private PlayerAvatar playerTarget;
private PhysGrabObject valuableTarget;
internal Vector3 attackPosition;
internal Vector3 attackVisionPosition;
private float valuableAttackPositionTimer;
private void Awake()
{
if (!Object.op_Implicit((Object)(object)instance))
{
instance = this;
if (!Application.isEditor || (SemiFunc.IsMultiplayer() && !GameManager.instance.localTest))
{
debugDraw = false;
debugOneOnly = false;
debugShortIdle = false;
debugLongIdle = false;
}
((Component)this).transform.parent = LevelGenerator.Instance.EnemyParent.transform;
((MonoBehaviour)this).StartCoroutine(Setup());
}
else
{
Object.Destroy((Object)(object)this);
}
}
[IteratorStateMachine(typeof(<Setup>d__18))]
private IEnumerator Setup()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Setup>d__18(0)
{
<>4__this = this
};
}
private void Update()
{
//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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
if (!setup)
{
return;
}
if (debugDraw)
{
if (currentState == State.Idle)
{
Debug.DrawRay(((Component)this).transform.position, Vector3.up * 2f, Color.green);
foreach (EnemyGnoelma gnoelma in gnoelmas)
{
Debug.DrawRay(destinations[gnoelmas.IndexOf(gnoelma)], Vector3.up * 2f, Color.yellow);
}
}
else if (currentState == State.AttackPlayer)
{
Debug.DrawRay(attackPosition, Vector3.up * 2f, Color.red);
}
}
if (SemiFunc.IsMasterClientOrSingleplayer())
{
switch (currentState)
{
case State.Idle:
StateIdle();
break;
case State.Leave:
StateLeave();
break;
case State.ChangeDestination:
StateChangeDestination();
break;
case State.Investigate:
StateInvestigate();
break;
case State.AttackSet:
StateAttackSet();
break;
case State.AttackPlayer:
StateAttackPlayer();
break;
case State.AttackValuable:
StateAttackValuable();
break;
}
}
}
private void StateIdle()
{
if (stateImpulse)
{
stateImpulse = false;
stateTimer = Random.Range(20f, 30f);
if (debugShortIdle)
{
stateTimer *= 0.5f;
}
if (debugLongIdle)
{
stateTimer *= 2f;
}
}
if (!SemiFunc.EnemySpawnIdlePause())
{
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.ChangeDestination);
}
LeaveCheck();
}
}
private void StateLeave()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
bool flag = false;
LevelPoint val = SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 5f);
if (Object.op_Implicit((Object)(object)val))
{
flag = SetPosition(((Component)val).transform.position);
}
if (flag)
{
stateImpulse = false;
UpdateState(State.Idle);
}
}
}
private void StateChangeDestination()
{
//IL_0017: 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_006a: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
bool flag = false;
LevelPoint val = SemiFunc.LevelPointGet(((Component)this).transform.position, 10f, 25f);
if (!Object.op_Implicit((Object)(object)val))
{
val = SemiFunc.LevelPointGet(((Component)this).transform.position, 0f, 999f);
}
if (Object.op_Implicit((Object)(object)val))
{
flag = SetPosition(((Component)val).transform.position);
}
if (flag)
{
stateImpulse = false;
UpdateState(State.Idle);
}
}
}
private void StateInvestigate()
{
if (stateImpulse)
{
stateImpulse = false;
UpdateState(State.Idle);
}
}
private void StateAttackSet()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (!stateImpulse)
{
return;
}
stateImpulse = false;
valuableTarget = null;
float num = 0f;
Collider[] array = Physics.OverlapSphere(((Component)playerTarget).transform.position, 3f, LayerMask.GetMask(new string[1] { "PhysGrabObject" }));
for (int i = 0; i < array.Length; i++)
{
ValuableObject componentInParent = ((Component)array[i]).GetComponentInParent<ValuableObject>();
if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.dollarValueCurrent > num)
{
num = componentInParent.dollarValueCurrent;
valuableTarget = componentInParent.physGrabObject;
}
}
if (Object.op_Implicit((Object)(object)valuableTarget))
{
UpdateState(State.AttackValuable);
}
else
{
UpdateState(State.AttackPlayer);
}
}
private void StateAttackPlayer()
{
//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_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_00c6: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 3f;
}
PauseGnoelmaSpawnedTimers();
if (Object.op_Implicit((Object)(object)playerTarget) && !playerTarget.isDisabled)
{
if (stateTimer > 0.5f)
{
attackPosition = ((Component)playerTarget).transform.position;
attackVisionPosition = playerTarget.PlayerVisionTarget.VisionTransform.position;
}
}
else
{
stateTimer = 0f;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
SetPosition(attackPosition);
UpdateState(State.Idle);
}
}
private void StateAttackValuable()
{
//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_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_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_0120: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 10f;
valuableAttackPositionTimer = 0f;
}
PauseGnoelmaSpawnedTimers();
if (Object.op_Implicit((Object)(object)valuableTarget))
{
if (valuableAttackPositionTimer <= 0f)
{
valuableAttackPositionTimer = 0.2f;
attackPosition = valuableTarget.centerPoint;
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(valuableTarget.centerPoint, Vector3.down, ref val, 2f, LayerMask.GetMask(new string[1] { "Default" })))
{
attackPosition = ((RaycastHit)(ref val)).point;
}
}
else
{
valuableAttackPositionTimer -= Time.deltaTime;
}
attackVisionPosition = valuableTarget.centerPoint;
}
else
{
stateTimer = 0f;
}
bool flag = false;
foreach (EnemyGnoelma gnoelma in gnoelmas)
{
if (Vector3.Distance(((Component)((EnemyGnome)gnoelma).enemy.Rigidbody).transform.position, attackPosition) <= 1f)
{
flag = true;
break;
}
}
if (!flag)
{
stateTimer -= Time.deltaTime;
}
bool flag2 = true;
foreach (EnemyGnoelma gnoelma2 in gnoelmas)
{
if (((Behaviour)gnoelma2).isActiveAndEnabled)
{
flag2 = false;
break;
}
}
if (stateTimer <= 0f || flag2)
{
SetPosition(attackPosition);
UpdateState(State.Idle);
}
}
private void UpdateState(State _state)
{
currentState = _state;
stateImpulse = true;
stateTimer = 0f;
}
private bool SetPosition(Vector3 _initialPosition)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: 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_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(_initialPosition, ref val, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })) && !SemiFunc.EnemyPhysObjectSphereCheck(((NavMeshHit)(ref val)).position, 1f))
{
((Component)this).transform.position = ((NavMeshHit)(ref val)).position;
((Component)this).transform.rotation = Quaternion.identity;
float num = 360f / (float)gnoelmas.Count;
NavMeshHit val3 = default(NavMeshHit);
foreach (EnemyGnoelma gnoelma in gnoelmas)
{
float num2 = 0f;
Vector3 value = ((Component)this).transform.position;
Vector3 val2 = ((Component)this).transform.position;
for (; num2 < 2f; num2 += 0.1f)
{
value = val2;
val2 = ((NavMeshHit)(ref val)).position + ((Component)this).transform.forward * num2;
if (!NavMesh.SamplePosition(val2, ref val3, 5f, -1) || !Physics.Raycast(val2, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
{
break;
}
Vector3 val4 = val2 + Vector3.up * 0.5f - (((NavMeshHit)(ref val)).position + Vector3.up * 0.5f);
Vector3 normalized = ((Vector3)(ref val4)).normalized;
if (Physics.Raycast(val2 + Vector3.up * 0.5f, normalized, ((Vector3)(ref normalized)).magnitude, LayerMask.GetMask(new string[2] { "Default", "PhysGrabObjectHinge" })) || (num2 > 0.5f && Random.Range(0, 100) < 15))
{
break;
}
}
destinations[gnoelmas.IndexOf(gnoelma)] = value;
Transform transform = ((Component)this).transform;
Quaternion rotation = ((Component)this).transform.rotation;
transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y + num, 0f);
}
return true;
}
return false;
}
public void Investigate(Vector3 _position)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (currentState != State.Investigate && currentState != State.AttackSet && currentState != State.AttackPlayer && currentState != State.AttackValuable)
{
SetPosition(_position);
UpdateState(State.Investigate);
}
}
public void SetTarget(PlayerAvatar _player)
{
if (currentState != State.AttackSet && currentState != State.AttackPlayer && currentState != State.AttackValuable)
{
playerTarget = _player;
UpdateState(State.AttackSet);
}
else if (currentState == State.AttackPlayer && (Object)(object)playerTarget == (Object)(object)_player)
{
stateTimer = 2f;
}
}
public void SeeTarget()
{
if (currentState == State.AttackPlayer)
{
stateTimer = 1f;
}
}
public bool CanAttack(EnemyGnoelma _gnoelma)
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
if (((EnemyGnome)_gnoelma).attackCooldown > 0f || ((EnemyGnome)_gnoelma).enemy.Jump.jumping)
{
return false;
}
if (currentState == State.AttackPlayer)
{
if (Vector3.Distance(((Component)((EnemyGnome)_gnoelma).enemy.Rigidbody).transform.position, attackPosition) <= 0.7f)
{
return true;
}
}
else if (Object.op_Implicit((Object)(object)valuableTarget))
{
((EnemyGnome)_gnoelma).overlapCheckCooldown = 1f;
if (((EnemyGnome)_gnoelma).overlapCheckTimer <= 0f)
{
((EnemyGnome)_gnoelma).overlapCheckTimer = 0.5f;
((EnemyGnome)_gnoelma).overlapCheckPrevious = false;
Collider[] array = Physics.OverlapSphere(((Component)((EnemyGnome)_gnoelma).enemy.Rigidbody).transform.position, 0.7f, LayerMask.GetMask(new string[1] { "PhysGrabObject" }));
for (int i = 0; i < array.Length; i++)
{
ValuableObject componentInParent = ((Component)array[i]).GetComponentInParent<ValuableObject>();
if (Object.op_Implicit((Object)(object)componentInParent) && (Object)(object)componentInParent.physGrabObject == (Object)(object)valuableTarget)
{
((EnemyGnome)_gnoelma).overlapCheckPrevious = true;
}
}
}
return ((EnemyGnome)_gnoelma).overlapCheckPrevious;
}
return false;
}
private void PauseGnoelmaSpawnedTimers()
{
foreach (EnemyGnoelma gnoelma in gnoelmas)
{
((EnemyGnome)gnoelma).enemy.EnemyParent.SpawnedTimerPause(0.1f);
}
}
private void LeaveCheck()
{
bool flag = false;
foreach (EnemyGnoelma gnoelma in gnoelmas)
{
if (SemiFunc.EnemyForceLeave(((EnemyGnome)gnoelma).enemy))
{
flag = true;
}
}
if (flag)
{
UpdateState(State.Leave);
}
}
public void OnSpawn()
{
foreach (EnemyGnoelma gnoelma in gnoelmas)
{
((EnemyGnome)gnoelma).enemy.EnemyParent.DespawnedTimerSet(((EnemyGnome)gnoelma).enemy.EnemyParent.DespawnedTimer - 30f, false);
}
}
}
namespace Gnoelma
{
[HarmonyPatch(typeof(PlayerController))]
internal static class ExamplePlayerControllerPatch
{
[HarmonyPrefix]
[HarmonyPatch("Start")]
private static void Start_Prefix(PlayerController __instance)
{
Gnoelma.Logger.LogDebug((object)$"{__instance} Start Prefix");
}
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void Start_Postfix(PlayerController __instance)
{
Gnoelma.Logger.LogDebug((object)$"{__instance} Start Postfix");
}
}
[BepInPlugin("Thalas.Gnoelma", "Gnoelma", "1.1.6")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Gnoelma : BaseUnityPlugin
{
internal static Gnoelma Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
LoadAssets();
}
private static void LoadAssets()
{
Debug.Log((object)"Loading Gnoelma bundle...");
AssetBundle val = LoadAssetBundle("gnoelma");
if (Object.op_Implicit((Object)(object)val))
{
Debug.Log((object)"Gnoelma bundle loaded successfully. Loading Enemy Setup...");
}
EnemySetup val2 = val.LoadAsset<EnemySetup>("assets/thalas.gnoelma/enemy - gnoelma.asset");
List<GameObject> list = val2.spawnObjects.Where((GameObject x) => Object.op_Implicit((Object)(object)x.GetComponent<EnemyParent>())).ToList();
Enemies.RegisterEnemy(val2);
Debug.Log((object)"Loaded Gnoelma enemy!");
}
public static AssetBundle LoadAssetBundle(string name)
{
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), name);
return AssetBundle.LoadFromFile(text);
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}