using System;
using System.Diagnostics;
using System.IO;
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;
using REPOLib.Modules;
using REPOLib.Objects.Sdk;
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("Andraxis")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("REPOBirdMod")]
[assembly: AssemblyTitle("REPOBirdMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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;
}
}
}
namespace REPOBirdMod
{
public class EnemyBird : MonoBehaviour
{
public enum State
{
Spawn,
Idle,
Roam,
Investigate,
Notice,
GoToPlayer,
GoToPlayerOver,
GoToPlayerUnder,
FlyBackToNavmesh,
FlyBackToNavmeshStop,
MoveBackToNavmesh,
AttackStart,
Transform,
ChaseNavmesh,
ChaseTowards,
ChaseMoveBack,
DeTransform,
Leave,
Stun,
Despawn,
PeckStart,
Peck
}
private PhotonView photonView;
public State currentState;
private bool stateImpulse;
public float stateTimer;
private float stateTicker;
private Vector3 targetPosition;
private float pitCheckTimer;
private bool pitCheck;
private Vector3 agentDestination;
private bool visionPrevious;
private float visionTimer;
private Vector3 moveBackPosition;
private float moveBackTimer;
private float targetForwardOffset = 1.5f;
public Transform followOffsetTransform;
[Space]
public SpringQuaternion bodySpring;
public Transform bodyTransform;
public Transform bodyTargetTransform;
[Space]
public EnemyBirdAnim anim;
public Enemy enemy;
public ParticleSystem featherParticles;
public ParticleSystem fleshParticles;
private PlayerAvatar playerTarget;
[Space]
private Quaternion rotationTarget;
public SpringQuaternion rotationSpring;
[Space]
public SpringQuaternion headLookAtSpring;
public Transform headLookAtTarget;
public Transform headLookAtSource;
private float targetedPlayerTime;
private float targetedPlayerTimeMax = 120f;
internal bool idleBreakerTrigger;
private float chaseTimer;
public bool peckCheck;
public bool peckChase;
private float annoyingJumpPauseTimer;
private bool duckBucketActive;
private float duckBucketTimer;
private void Awake()
{
enemy = ((Component)this).GetComponent<Enemy>();
photonView = ((Component)this).GetComponent<PhotonView>();
}
private void Update()
{
//IL_0013: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Invalid comparison between Unknown and I4
bodyTransform.rotation = SemiFunc.SpringQuaternionGet(bodySpring, bodyTargetTransform.rotation, -1f);
HeadLookAtLogic();
PeckCheckLogic();
if ((GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient) || !LevelGenerator.Instance.Generated)
{
return;
}
if (enemy.IsStunned())
{
UpdateState(State.Stun);
}
else if ((int)enemy.CurrentState == 11)
{
UpdateState(State.Despawn);
}
if (!Object.op_Implicit((Object)(object)playerTarget))
{
if (currentState == State.GoToPlayer || currentState == State.GoToPlayerOver || currentState == State.GoToPlayerUnder)
{
UpdateState(State.Idle);
}
else if (currentState == State.ChaseNavmesh || currentState == State.ChaseTowards || currentState == State.ChaseMoveBack || currentState == State.Transform)
{
UpdateState(State.DeTransform);
}
}
RotationLogic();
TimerLogic();
GravityLogic();
TargetPositionLogic();
FollowOffsetLogic();
FlyBackConditionLogic();
DuckBucketLogic();
switch (currentState)
{
case State.Spawn:
StateSpawn();
break;
case State.Idle:
StateIdle();
break;
case State.Roam:
StateRoam();
break;
case State.Investigate:
StateInvestigate();
break;
case State.Notice:
StateNotice();
break;
case State.GoToPlayer:
StateGoToPlayer();
break;
case State.GoToPlayerUnder:
StateGoToPlayerUnder();
break;
case State.GoToPlayerOver:
StateGoToPlayerOver();
break;
case State.MoveBackToNavmesh:
StateMoveBackToNavMesh();
break;
case State.FlyBackToNavmesh:
StateFlyBackToNavmesh();
break;
case State.FlyBackToNavmeshStop:
StateFlyBackToNavmeshStop();
break;
case State.AttackStart:
StateAttackStart();
break;
case State.Transform:
StateTransform();
break;
case State.ChaseNavmesh:
StateChaseNavmesh();
break;
case State.ChaseTowards:
StateChaseTowards();
break;
case State.ChaseMoveBack:
StateChaseMoveBack();
break;
case State.DeTransform:
StateDeTransform();
break;
case State.Stun:
StateStun();
break;
case State.Leave:
StateLeave();
break;
case State.Despawn:
StateDespawn();
break;
case State.PeckStart:
StatePeckStart();
break;
case State.Peck:
StatePeck();
break;
}
}
private void StateSpawn()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
enemy.NavMeshAgent.ResetPath();
stateImpulse = false;
stateTimer = 2f;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Idle);
}
}
private void StateIdle()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = Random.Range(2f, 5f);
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
enemy.NavMeshAgent.ResetPath();
}
if (!SemiFunc.EnemySpawnIdlePause())
{
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Roam);
}
LeaveCheck(_setLeave: true);
}
}
private void StateRoam()
{
//IL_0030: 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_007f: 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_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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 5f;
playerTarget = null;
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);
}
NavMeshHit val2 = default(NavMeshHit);
if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 3f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
{
enemy.NavMeshAgent.SetDestination(((NavMeshHit)(ref val2)).position);
flag = true;
}
if (!flag)
{
return;
}
enemy.Rigidbody.notMovingTimer = 0f;
}
else
{
SemiFunc.EnemyCartJump(enemy);
MoveBackPosition();
if (enemy.Rigidbody.notMovingTimer > 2f)
{
stateTimer -= Time.deltaTime;
}
if (stateTimer <= 0f || !enemy.NavMeshAgent.HasPath())
{
SemiFunc.EnemyCartJumpReset(enemy);
UpdateState(State.Idle);
}
}
LeaveCheck(_setLeave: true);
}
private void StateInvestigate()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateTimer = 5f;
enemy.Rigidbody.notMovingTimer = 0f;
stateImpulse = false;
}
else
{
enemy.NavMeshAgent.SetDestination(agentDestination);
SemiFunc.EnemyCartJump(enemy);
MoveBackPosition();
if (enemy.Rigidbody.notMovingTimer > 2f)
{
stateTimer -= Time.deltaTime;
}
if (stateTimer <= 0f || !enemy.NavMeshAgent.HasPath())
{
SemiFunc.EnemyCartJumpReset(enemy);
UpdateState(State.Idle);
}
}
LeaveCheck(_setLeave: true);
}
private void StateNotice()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.ResetPath();
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
stateImpulse = false;
stateTimer = 1f;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.GoToPlayer);
}
}
private void StateGoToPlayer()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: 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)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 5f;
annoyingJumpPauseTimer = 1f;
}
enemy.NavMeshAgent.SetDestination(targetPosition);
stateTimer -= Time.deltaTime;
SemiFunc.EnemyCartJump(enemy);
MoveBackPosition();
enemy.Vision.StandOverride(0.25f);
if (stateTimer <= 0f || !Object.op_Implicit((Object)(object)playerTarget) || playerTarget.isDisabled)
{
UpdateState(State.Idle);
return;
}
NavMeshHit val = default(NavMeshHit);
if (!enemy.NavMeshAgent.CanReach(targetPosition, 1f) && Vector3.Distance(((Component)enemy.Rigidbody).transform.position, enemy.NavMeshAgent.GetPoint()) < 2f && !VisionBlocked() && !NavMesh.SamplePosition(targetPosition, ref val, 0.5f, -1))
{
if (playerTarget.isCrawling && Mathf.Abs(targetPosition.y - ((Component)enemy.Rigidbody).transform.position.y) < 0.3f && !enemy.Jump.jumping)
{
UpdateState(State.GoToPlayerUnder);
return;
}
if (targetPosition.y > ((Component)enemy.Rigidbody).transform.position.y)
{
UpdateState(State.GoToPlayerOver);
return;
}
}
AnnoyingJump();
LeaveCheck(_setLeave: true);
}
private void StateGoToPlayerUnder()
{
//IL_004c: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateTimer = 2f;
stateImpulse = false;
annoyingJumpPauseTimer = 1f;
}
enemy.NavMeshAgent.Disable(0.1f);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, targetPosition, enemy.NavMeshAgent.DefaultSpeed * 0.5f * Time.deltaTime);
SemiFunc.EnemyCartJump(enemy);
enemy.Vision.StandOverride(0.25f);
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(targetPosition, ref val, 0.5f, -1))
{
UpdateState(State.MoveBackToNavmesh);
}
else if (VisionBlocked() || !Object.op_Implicit((Object)(object)playerTarget) || playerTarget.isDisabled)
{
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.MoveBackToNavmesh);
}
}
else
{
stateTimer = 2f;
}
if (LeaveCheck(_setLeave: false))
{
UpdateState(State.MoveBackToNavmesh);
}
}
private void StateGoToPlayerOver()
{
//IL_004c: 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_0073: 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_00ca: 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_010f: 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_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: 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_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: 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_0187: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateTimer = 2f;
stateImpulse = false;
annoyingJumpPauseTimer = 1f;
}
enemy.NavMeshAgent.Disable(0.1f);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, targetPosition, enemy.NavMeshAgent.DefaultSpeed * 0.5f * Time.deltaTime);
SemiFunc.EnemyCartJump(enemy);
enemy.Vision.StandOverride(0.25f);
if (playerTarget.PlayerVisionTarget.VisionTransform.position.y > ((Component)enemy.Rigidbody).transform.position.y + 1.5f)
{
if (!enemy.Jump.jumping)
{
Vector3 val = playerTarget.PlayerVisionTarget.VisionTransform.position - ((Component)enemy.Rigidbody).transform.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
enemy.Jump.StuckTrigger(normalized);
((Component)this).transform.position = ((Component)enemy.Rigidbody).transform.position;
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, targetPosition, 2f);
}
}
else
{
AnnoyingJump();
}
NavMeshHit val2 = default(NavMeshHit);
if (NavMesh.SamplePosition(targetPosition, ref val2, 0.5f, -1))
{
UpdateState(State.MoveBackToNavmesh);
}
else if (VisionBlocked() || !Object.op_Implicit((Object)(object)playerTarget) || playerTarget.isDisabled)
{
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f || enemy.Rigidbody.notMovingTimer > 1f)
{
UpdateState(State.MoveBackToNavmesh);
}
}
else
{
stateTimer = 2f;
}
if (LeaveCheck(_setLeave: false))
{
UpdateState(State.MoveBackToNavmesh);
}
}
private void StateMoveBackToNavMesh()
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: 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_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_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: 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_0129: 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_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: 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_01d2: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateTimer = 30f;
stateImpulse = false;
}
enemy.NavMeshAgent.Disable(0.1f);
if (!enemy.Jump.jumping)
{
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, moveBackPosition, enemy.NavMeshAgent.DefaultSpeed * Time.deltaTime);
}
SemiFunc.EnemyCartJump(enemy);
enemy.Vision.StandOverride(0.25f);
if ((Vector3.Distance(((Component)this).transform.position, ((Component)enemy.Rigidbody).transform.position) > 2f || enemy.Rigidbody.notMovingTimer > 2f) && !enemy.Jump.jumping)
{
Vector3 val = moveBackPosition - ((Component)enemy.Rigidbody).transform.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
enemy.Jump.StuckTrigger(normalized);
((Component)this).transform.position = ((Component)enemy.Rigidbody).transform.position;
Transform transform = ((Component)this).transform;
transform.position += normalized * 2f;
}
stateTimer -= Time.deltaTime;
NavMeshHit val2 = default(NavMeshHit);
if (Vector3.Distance(((Component)enemy.Rigidbody).transform.position, moveBackPosition) <= 0.5f || NavMesh.SamplePosition(((Component)enemy.Rigidbody).transform.position, ref val2, 0.5f, -1))
{
UpdateState(State.GoToPlayer);
}
else if (stateTimer <= 0f)
{
enemy.EnemyParent.SpawnedTimerSet(0f);
UpdateState(State.Despawn);
}
}
private void StateFlyBackToNavmesh()
{
//IL_004c: 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)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: 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_0147: 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_0192: 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_01a1: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 30f;
stateTicker = 0f;
}
enemy.NavMeshAgent.Disable(0.1f);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, moveBackPosition + Vector3.up * 0.5f, 0.75f * Time.deltaTime);
enemy.Rigidbody.OverrideFollowPosition(0.1f, 1f, -1f);
enemy.Rigidbody.OverrideFollowRotation(0.1f, 0.25f);
if (Vector3.Distance(((Component)enemy.Rigidbody).transform.position, ((Component)this).transform.position) > 2f)
{
((Component)this).transform.position = ((Component)enemy.Rigidbody).transform.position;
}
if (stateTicker <= 0f)
{
stateTicker = 0.25f;
RaycastHit val = default(RaycastHit);
NavMeshHit val2 = default(NavMeshHit);
if (Physics.Raycast(((Component)enemy.Rigidbody).transform.position, Vector3.down, ref val, 5f, LayerMask.GetMask(new string[1] { "Default" })) && Physics.Raycast(((Component)enemy.Rigidbody).transform.position + ((Component)enemy.Rigidbody).transform.forward * 0.5f, Vector3.down, ref val, 5f, LayerMask.GetMask(new string[1] { "Default" })) && NavMesh.SamplePosition(((RaycastHit)(ref val)).point, ref val2, 0.5f, -1))
{
moveBackPosition = ((NavMeshHit)(ref val2)).position;
UpdateState(State.FlyBackToNavmeshStop);
return;
}
}
else
{
stateTicker -= Time.deltaTime;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Despawn);
}
}
private void StateFlyBackToNavmeshStop()
{
//IL_0018: 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)
if (stateImpulse)
{
enemy.NavMeshAgent.Warp(moveBackPosition, false);
enemy.NavMeshAgent.ResetPath();
((Component)this).transform.position = moveBackPosition;
stateTimer = 1f;
stateImpulse = false;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Idle);
}
}
private void StateAttackStart()
{
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 0.5f;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
enemy.Rigidbody.GrabRelease(true, 0.1f);
UpdateState(State.Transform);
}
}
private void StatePeckStart()
{
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 0.5f;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
enemy.Rigidbody.GrabRelease(true, 0.1f);
UpdateState(State.Peck);
}
}
private void StateTransform()
{
//IL_003d: 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_0067: 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_008d: 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)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 1.4f;
}
enemy.NavMeshAgent.Disable(0.1f);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(((Component)this).transform.position.x, playerTarget.PlayerVisionTarget.VisionTransform.position.y, ((Component)this).transform.position.z);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, val, Time.deltaTime);
stateTimer -= Time.deltaTime;
((Component)fleshParticles).transform.position = enemy.CenterTransform.position;
fleshParticles.Play();
if (stateTimer <= 0f)
{
UpdateState(State.ChaseNavmesh);
}
}
private void StatePeck()
{
//IL_003d: 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_0067: 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_008d: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 1.4f;
}
enemy.NavMeshAgent.Disable(0.1f);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(((Component)this).transform.position.x, playerTarget.PlayerVisionTarget.VisionTransform.position.y, ((Component)this).transform.position.z);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, val, Time.deltaTime);
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.ChaseNavmesh);
}
peckChase = true;
}
private void StateChaseNavmesh()
{
//IL_00bc: 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 (stateImpulse)
{
stateImpulse = false;
}
if (peckChase)
{
((Component)enemy).GetComponent<NavMeshAgent>().stoppingDistance = 0.8f;
enemy.NavMeshAgent.OverrideAgent(5f, 5f, 0.1f);
enemy.NavMeshAgent.SetDestination(targetPosition);
}
else
{
((Component)enemy).GetComponent<NavMeshAgent>().stoppingDistance = 0.5f;
enemy.NavMeshAgent.OverrideAgent(10f, 10f, 0.1f);
enemy.NavMeshAgent.SetDestination(((Component)playerTarget).transform.position);
}
if (!VisionBlocked())
{
UpdateState(State.ChaseTowards);
return;
}
MoveBackPosition();
ChaseStop();
}
private void StateChaseTowards()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
if (stateImpulse)
{
stateImpulse = false;
}
if (VisionBlocked())
{
UpdateState(State.ChaseMoveBack);
return;
}
enemy.NavMeshAgent.Disable(0.1f);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, ((Component)playerTarget.localCamera).transform.position + Vector3.down * 0.31f, 5f * Time.deltaTime);
ChaseStop();
}
private void StateChaseMoveBack()
{
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_00e2: 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_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_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_017f: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
RaycastHit val = default(RaycastHit);
NavMeshHit val2 = default(NavMeshHit);
if (Physics.Raycast(((Component)enemy.Rigidbody).transform.position, Vector3.down, ref val, 5f, LayerMask.GetMask(new string[1] { "Default" })) && NavMesh.SamplePosition(((RaycastHit)(ref val)).point, ref val2, 0.5f, -1))
{
moveBackPosition = ((NavMeshHit)(ref val2)).position;
}
stateImpulse = false;
stateTimer = 10f;
}
enemy.NavMeshAgent.Disable(0.1f);
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, moveBackPosition, 5f * Time.deltaTime);
if (Vector3.Distance(((Component)this).transform.position, ((Component)enemy.Rigidbody).transform.position) > 2f || enemy.Rigidbody.notMovingTimer > 2f)
{
((Component)this).transform.position = ((Component)enemy.Rigidbody).transform.position;
}
stateTimer -= Time.deltaTime;
NavMeshHit val3 = default(NavMeshHit);
if (Vector3.Distance(((Component)enemy.Rigidbody).transform.position, moveBackPosition) <= 1f || NavMesh.SamplePosition(((Component)enemy.Rigidbody).transform.position, ref val3, 0.5f, -1))
{
UpdateState(State.ChaseNavmesh);
}
else
{
ChaseStop();
}
}
private void StateDeTransform()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
enemy.NavMeshAgent.ResetPath();
stateImpulse = false;
stateTimer = 2f;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.MoveBackToNavmesh);
}
}
private void StateStun()
{
//IL_0059: 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)
if (enemy.IsStunned())
{
return;
}
PlayerAvatar val = null;
float num = 999f;
foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
{
if (Object.op_Implicit((Object)(object)item) && !item.isDisabled)
{
float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position);
if (num2 < 10f && num2 < num)
{
num = num2;
val = item;
}
}
}
if (Object.op_Implicit((Object)(object)val))
{
if (Object.op_Implicit((Object)(object)enemy.Vision.onVisionTriggeredPlayer))
{
playerTarget = enemy.Vision.onVisionTriggeredPlayer;
}
else
{
playerTarget = val;
}
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { playerTarget.photonView.ViewID });
}
UpdateState(State.AttackStart);
}
else
{
UpdateState(State.Idle);
}
}
private void StateLeave()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: 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_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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//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_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateTimer = 5f;
bool flag = false;
LevelPoint val = SemiFunc.LevelPointGetPlayerDistance(((Component)this).transform.position, 30f, 50f, false);
if (!Object.op_Implicit((Object)(object)val))
{
val = SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 5f);
}
NavMeshHit val2 = default(NavMeshHit);
if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 1f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
{
agentDestination = ((NavMeshHit)(ref val2)).position;
flag = true;
}
if (flag)
{
enemy.NavMeshAgent.SetDestination(agentDestination);
enemy.Rigidbody.notMovingTimer = 0f;
stateImpulse = false;
}
SemiFunc.EnemyLeaveStart(enemy);
}
else
{
if (enemy.Rigidbody.notMovingTimer > 2f)
{
stateTimer -= Time.deltaTime;
}
SemiFunc.EnemyCartJump(enemy);
if (Vector3.Distance(((Component)this).transform.position, agentDestination) < 1f || stateTimer <= 0f)
{
SemiFunc.EnemyCartJumpReset(enemy);
UpdateState(State.Idle);
}
}
}
private void StateDespawn()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
enemy.NavMeshAgent.ResetPath();
stateImpulse = false;
}
}
public void OnInvestigate()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer() && (currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate))
{
agentDestination = enemy.StateInvestigate.onInvestigateTriggeredPosition;
UpdateState(State.Investigate);
}
}
public void OnVision()
{
if ((currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate || currentState == State.Leave) && !enemy.Jump.jumping)
{
if (SemiFunc.IsMasterClientOrSingleplayer())
{
playerTarget = enemy.Vision.onVisionTriggeredPlayer;
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { playerTarget.photonView.ViewID });
}
UpdateState(State.Notice);
}
}
else if (currentState == State.GoToPlayer || currentState == State.GoToPlayerOver || currentState == State.GoToPlayerUnder)
{
stateTimer = 2f;
}
}
public void OnHurt()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
anim.soundHurtPauseTimer = 0.5f;
anim.hurtSound.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
if (!enemy.IsStunned() && Object.op_Implicit((Object)(object)playerTarget) && (currentState == State.GoToPlayer || currentState == State.GoToPlayerOver || currentState == State.GoToPlayerUnder || (currentState == State.ChaseNavmesh && peckChase)))
{
UpdateState(State.AttackStart);
peckChase = false;
}
}
public void OnDeath()
{
//IL_0025: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
GameDirector.instance.CameraShake.ShakeDistance(3f, 3f, 10f, enemy.CenterTransform.position, 0.5f);
GameDirector.instance.CameraImpact.ShakeDistance(3f, 3f, 10f, enemy.CenterTransform.position, 0.05f);
((Component)featherParticles).transform.position = enemy.CenterTransform.position;
featherParticles.Play();
anim.deathSound.Play(enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
if (SemiFunc.IsMasterClientOrSingleplayer())
{
enemy.EnemyParent.Despawn();
}
}
public void OnGrabbed()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && currentState != State.Peck && currentState != State.PeckStart && currentState != State.AttackStart && currentState != State.Transform && currentState != State.ChaseNavmesh && currentState != State.ChaseTowards && currentState != State.ChaseMoveBack && currentState != State.DeTransform && currentState != State.Stun && currentState != State.Despawn)
{
playerTarget = enemy.Rigidbody.onGrabbedPlayerAvatar;
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { playerTarget.photonView.ViewID });
}
UpdateState(State.PeckStart);
}
}
public void OnObjectHurt()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && Object.op_Implicit((Object)(object)enemy.Health.onObjectHurtPlayer) && currentState != State.AttackStart && currentState != State.Transform && currentState != State.ChaseNavmesh && currentState != State.ChaseTowards && currentState != State.ChaseMoveBack && currentState != State.DeTransform && currentState != State.Stun && currentState != State.Despawn)
{
playerTarget = enemy.Health.onObjectHurtPlayer;
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { playerTarget.photonView.ViewID });
}
UpdateState(State.AttackStart);
}
}
private void UpdateState(State _state)
{
//IL_0068: 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)
if (currentState != _state)
{
currentState = _state;
stateImpulse = true;
stateTimer = 0f;
if (GameManager.Multiplayer())
{
photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { currentState });
}
else
{
UpdateStateRPC(currentState);
}
}
}
public void OnSpawn()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(enemy))
{
UpdateState(State.Spawn);
}
}
public void TargetPositionLogic()
{
//IL_0047: 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_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_0094: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
if ((currentState == State.GoToPlayer || currentState == State.GoToPlayerOver || currentState == State.GoToPlayerUnder || currentState == State.ChaseNavmesh) && Object.op_Implicit((Object)(object)playerTarget))
{
Vector3 val = ((Component)playerTarget).transform.position + ((Component)playerTarget).transform.forward * targetForwardOffset;
if (pitCheckTimer <= 0f)
{
pitCheckTimer = 0.1f;
pitCheck = !Physics.Raycast(val + Vector3.up, Vector3.down, 4f, LayerMask.GetMask(new string[1] { "Default" }));
}
else
{
pitCheckTimer -= Time.deltaTime;
}
if (pitCheck)
{
val = ((Component)playerTarget).transform.position;
}
targetPosition = Vector3.Lerp(targetPosition, val, 20f * Time.deltaTime);
}
}
private void AnnoyingJump()
{
//IL_0030: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: 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_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: 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)
if (!enemy.Jump.jumping && !(annoyingJumpPauseTimer > 0f) && playerTarget.PlayerVisionTarget.VisionTransform.position.y > ((Component)enemy.Rigidbody).transform.position.y && enemy.Rigidbody.timeSinceStun > 2f)
{
Vector3 val = ((Component)playerTarget.localCamera).transform.position + ((Component)playerTarget.localCamera).transform.forward;
float num = new Vector3(((Component)enemy.Rigidbody).transform.position.x, val.y, ((Component)enemy.Rigidbody).transform.position.z).y - enemy.CenterTransform.position.y;
if (!enemy.OnScreen.GetOnScreen(playerTarget) && num > 1f && !playerTarget.isMoving)
{
enemy.Jump.StuckTrigger(targetPosition - enemy.Vision.VisionTransform.position);
}
}
}
private void RotationLogic()
{
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00b4: 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_00cf: 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_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: 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)
if (Object.op_Implicit((Object)(object)playerTarget) && (currentState == State.Notice || currentState == State.GoToPlayer || currentState == State.GoToPlayerOver || currentState == State.GoToPlayerUnder))
{
if ((!VisionBlocked() && !playerTarget.isMoving && ((Vector3)(ref enemy.Rigidbody.velocity)).magnitude < 0.5f) || enemy.Jump.jumping)
{
rotationTarget = Quaternion.LookRotation(((Component)playerTarget).transform.position - ((Component)enemy.Rigidbody).transform.position);
((Quaternion)(ref rotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref rotationTarget)).eulerAngles.y, 0f);
}
else if (((Vector3)(ref enemy.Rigidbody.velocity)).magnitude > 0.1f)
{
rotationTarget = Quaternion.LookRotation(((Vector3)(ref enemy.Rigidbody.velocity)).normalized);
((Quaternion)(ref rotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref rotationTarget)).eulerAngles.y, 0f);
}
}
else if (Object.op_Implicit((Object)(object)playerTarget) && (currentState == State.ChaseNavmesh || currentState == State.ChaseTowards || currentState == State.Transform))
{
rotationTarget = Quaternion.LookRotation(((Component)playerTarget).transform.position - ((Component)enemy.Rigidbody).transform.position);
((Quaternion)(ref rotationTarget)).eulerAngles = new Vector3(((Quaternion)(ref rotationTarget)).eulerAngles.x, ((Quaternion)(ref rotationTarget)).eulerAngles.y, ((Quaternion)(ref rotationTarget)).eulerAngles.z);
}
else if (((Vector3)(ref enemy.Rigidbody.velocity)).magnitude > 0.1f)
{
rotationTarget = Quaternion.LookRotation(((Vector3)(ref enemy.Rigidbody.velocity)).normalized);
if (currentState != State.ChaseMoveBack)
{
((Quaternion)(ref rotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref rotationTarget)).eulerAngles.y, 0f);
}
}
((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(rotationSpring, rotationTarget, -1f);
}
private void GravityLogic()
{
if (currentState == State.ChaseNavmesh || currentState == State.ChaseTowards || currentState == State.ChaseMoveBack || currentState == State.Transform || currentState == State.FlyBackToNavmesh || currentState == State.Peck)
{
enemy.Rigidbody.gravity = false;
}
else
{
enemy.Rigidbody.gravity = true;
}
}
private void MoveBackPosition()
{
//IL_0027: 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_0046: 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)
if (moveBackTimer <= 0f)
{
moveBackTimer = 0.1f;
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(((Component)this).transform.position, ref val, 0.5f, -1) && Physics.Raycast(((Component)this).transform.position, Vector3.down, 2f, LayerMask.GetMask(new string[1] { "Default" })))
{
moveBackPosition = ((NavMeshHit)(ref val)).position;
}
}
}
private bool VisionBlocked()
{
//IL_0031: 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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
if (visionTimer <= 0f)
{
visionTimer = 0.25f;
Vector3 val = playerTarget.PlayerVisionTarget.VisionTransform.position - enemy.CenterTransform.position;
visionPrevious = Physics.Raycast(enemy.CenterTransform.position, val, ((Vector3)(ref val)).magnitude, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1);
}
return visionPrevious;
}
private void TimerLogic()
{
visionTimer -= Time.deltaTime;
moveBackTimer -= Time.deltaTime;
annoyingJumpPauseTimer -= Time.deltaTime;
if (currentState == State.ChaseNavmesh || currentState == State.ChaseTowards || currentState == State.ChaseMoveBack)
{
chaseTimer += Time.deltaTime;
}
else
{
chaseTimer = 0f;
}
if (currentState == State.Spawn)
{
targetedPlayerTime = 0f;
}
if (currentState == State.GoToPlayer || currentState == State.GoToPlayerOver || currentState == State.GoToPlayerUnder)
{
targetedPlayerTime += Time.deltaTime;
return;
}
targetedPlayerTime -= 5f * Time.deltaTime;
targetedPlayerTime = Mathf.Max(0f, targetedPlayerTime);
}
private void HeadLookAtLogic()
{
//IL_00c8: 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_0063: 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_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
if ((currentState == State.Notice || currentState == State.GoToPlayer || currentState == State.GoToPlayerOver || currentState == State.GoToPlayerUnder) && Object.op_Implicit((Object)(object)playerTarget) && !playerTarget.isDisabled)
{
flag = true;
}
if (flag)
{
Vector3 val = playerTarget.PlayerVisionTarget.VisionTransform.position - headLookAtTarget.position;
val = SemiFunc.ClampDirection(val, headLookAtTarget.forward, 60f);
headLookAtSource.rotation = SemiFunc.SpringQuaternionGet(headLookAtSpring, Quaternion.LookRotation(val), -1f);
}
else
{
headLookAtSource.rotation = SemiFunc.SpringQuaternionGet(headLookAtSpring, headLookAtTarget.rotation, -1f);
}
}
private bool LeaveCheck(bool _setLeave)
{
if (SemiFunc.EnemyForceLeave(enemy) || targetedPlayerTime >= targetedPlayerTimeMax)
{
if (_setLeave)
{
UpdateState(State.Leave);
}
return true;
}
return false;
}
public void IdleBreakerSet()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("IdleBreakerSetRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
IdleBreakerSetRPC();
}
}
private void ChaseStop()
{
if (chaseTimer >= 10f || !Object.op_Implicit((Object)(object)playerTarget) || playerTarget.isDisabled)
{
UpdateState(State.DeTransform);
((Component)enemy).GetComponent<NavMeshAgent>().stoppingDistance = 0f;
peckChase = false;
}
}
private void FollowOffsetLogic()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_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_00a4: 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 (currentState == State.ChaseNavmesh || currentState == State.ChaseMoveBack || currentState == State.FlyBackToNavmesh)
{
followOffsetTransform.localPosition = Vector3.Lerp(followOffsetTransform.localPosition, Vector3.up * 0.75f, 5f * Time.deltaTime);
}
else if (currentState == State.FlyBackToNavmeshStop)
{
followOffsetTransform.localPosition = Vector3.zero;
}
else
{
followOffsetTransform.localPosition = Vector3.Lerp(followOffsetTransform.localPosition, Vector3.zero, 10f * Time.deltaTime);
}
}
private void FlyBackConditionLogic()
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
if ((currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate || currentState == State.Notice || currentState == State.GoToPlayer || currentState == State.GoToPlayerOver || currentState == State.GoToPlayerUnder || currentState == State.MoveBackToNavmesh) && ((Component)enemy.Rigidbody).transform.position.y - moveBackPosition.y < -4f)
{
UpdateState(State.FlyBackToNavmesh);
}
}
private void PeckCheckLogic()
{
//IL_0045: 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_0069: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
if (peckChase && (currentState == State.Peck || currentState == State.ChaseTowards || currentState == State.ChaseNavmesh))
{
float num = Vector2.Distance(new Vector2(((Component)enemy.Rigidbody).transform.position.x, ((Component)enemy.Rigidbody).transform.position.z), new Vector2(playerTarget.PlayerVisionTarget.VisionTransform.position.x, playerTarget.PlayerVisionTarget.VisionTransform.position.z));
float num2 = Mathf.Abs(((Component)enemy.Rigidbody).transform.position.y - playerTarget.PlayerVisionTarget.VisionTransform.position.y);
if (num < 1.5f && num2 < 1f)
{
peckCheck = true;
enemy.Rigidbody.velocity = Vector3.zero;
}
else
{
peckCheck = false;
}
}
else
{
peckCheck = false;
}
}
private void DuckBucketLogic()
{
if (duckBucketActive)
{
enemy.Vision.DisableVision(0.25f);
enemy.EnemyParent.SpawnedTimerPause(0.25f);
enemy.NavMeshAgent.OverrideAgent(0.5f, 0.5f, 0.25f);
enemy.Jump.GapJumpOverride(0.25f, 1f, 1f);
enemy.Jump.StuckJumpOverride(0.25f, 1f, 1f);
enemy.Jump.SurfaceJumpOverride(0.25f, 1f, 1f);
if (duckBucketTimer <= 0f)
{
duckBucketActive = false;
}
duckBucketTimer -= Time.deltaTime;
}
}
public void DuckBucketActive()
{
if (currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate || currentState == State.Notice || currentState == State.GoToPlayer || currentState == State.GoToPlayerOver || currentState == State.GoToPlayerUnder || currentState == State.MoveBackToNavmesh || currentState == State.Leave)
{
duckBucketActive = true;
duckBucketTimer = 0.25f;
}
}
[PunRPC]
private void UpdateStateRPC(State _state, PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterOnlyRPC(_info))
{
currentState = _state;
if (currentState == State.Spawn)
{
anim.OnSpawn();
}
}
}
[PunRPC]
private void UpdatePlayerTargetRPC(int _photonViewID, PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (!SemiFunc.MasterOnlyRPC(_info))
{
return;
}
foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
{
if (item.photonView.ViewID == _photonViewID)
{
playerTarget = item;
break;
}
}
}
[PunRPC]
private void IdleBreakerSetRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterOnlyRPC(_info))
{
idleBreakerTrigger = true;
}
}
}
public class EnemyBirdAnim : MonoBehaviour
{
public Enemy enemy;
internal Animator animator;
public EnemyBird controller;
internal MaterialTrigger material = new MaterialTrigger();
public Sound quackSound;
public Sound stunSound;
public Sound stunStopSound;
public Sound biteSound;
public Sound transformSound;
public Sound jumpSound;
public Sound footstepSound;
public Sound mouthExtendSound;
public Sound mouthRetractSound;
public Sound attackLoopSound;
public Sound hurtSound;
public Sound deathSound;
public Sound noticeSound;
public Sound flyFlapSound;
public Sound flyLoopSound;
public float soundHurtPauseTimer;
private bool jumpImpulse;
private bool flyImpulse;
private bool landImpulse;
private bool stunImpulse;
private bool noticeImpulse;
private bool transformImpulse;
private bool peckImpulse;
private float idleBreakerTimer;
private float peckPauseTimer;
private void Awake()
{
animator = ((Component)this).GetComponent<Animator>();
animator.keepAnimatorStateOnDisable = true;
}
private void Update()
{
//IL_0031: 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)
//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0755: Unknown result type (might be due to invalid IL or missing references)
AnimatorStateInfo currentAnimatorStateInfo;
if (enemy.Rigidbody.frozen)
{
animator.speed = 0f;
}
else
{
currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Walk") && !animator.IsInTransition(0))
{
animator.speed = Mathf.Clamp(((Vector3)(ref enemy.Rigidbody.velocity)).magnitude + 0.2f, 0.8f, 1.2f);
}
else
{
animator.speed = 1f;
}
}
if (controller.currentState != EnemyBird.State.AttackStart && controller.currentState != EnemyBird.State.Transform && controller.currentState != EnemyBird.State.ChaseNavmesh && controller.currentState != EnemyBird.State.ChaseTowards && controller.currentState != EnemyBird.State.ChaseMoveBack && controller.currentState != EnemyBird.State.DeTransform)
{
if (((Vector3)(ref enemy.Rigidbody.velocity)).magnitude > 0.1f)
{
animator.SetBool("move", true);
}
else
{
animator.SetBool("move", false);
}
if (!enemy.IsStunned())
{
if (!enemy.Grounded.grounded && (controller.currentState == EnemyBird.State.FlyBackToNavmesh || controller.currentState == EnemyBird.State.FlyBackToNavmeshStop))
{
if (flyImpulse)
{
animator.SetTrigger("fly");
animator.SetBool("falling", false);
flyImpulse = false;
landImpulse = true;
}
else if (controller.currentState == EnemyBird.State.FlyBackToNavmeshStop)
{
animator.SetBool("falling", true);
}
}
else if (enemy.Jump.jumping)
{
if (jumpImpulse)
{
animator.SetTrigger("jump");
animator.SetBool("falling", false);
jumpImpulse = false;
landImpulse = true;
}
else if (controller.enemy.Rigidbody.physGrabObject.rbVelocity.y < 0f)
{
animator.SetBool("falling", true);
}
}
else
{
if (landImpulse)
{
animator.SetTrigger("land");
landImpulse = false;
}
animator.SetBool("falling", false);
jumpImpulse = true;
flyImpulse = true;
}
}
}
if (controller.currentState == EnemyBird.State.Peck || controller.currentState == EnemyBird.State.ChaseNavmesh || controller.currentState == EnemyBird.State.ChaseTowards)
{
if (peckImpulse && controller.peckChase)
{
animator.SetBool("angry", true);
animator.SetBool("move", false);
peckImpulse = false;
}
}
else
{
peckImpulse = true;
animator.SetBool("angry", false);
animator.SetBool("move", true);
}
if (peckPauseTimer > 0f)
{
peckPauseTimer -= Time.deltaTime;
}
if (controller.peckCheck && controller.peckChase && peckPauseTimer <= 0f)
{
animator.SetTrigger("peck");
peckPauseTimer = 1.5f;
}
if (controller.currentState == EnemyBird.State.AttackStart)
{
if (transformImpulse)
{
animator.SetTrigger("transform");
transformImpulse = false;
}
}
else
{
transformImpulse = true;
}
if ((controller.currentState == EnemyBird.State.AttackStart || controller.currentState == EnemyBird.State.Transform || controller.currentState == EnemyBird.State.ChaseNavmesh || controller.currentState == EnemyBird.State.ChaseTowards || controller.currentState == EnemyBird.State.ChaseMoveBack) && !controller.peckChase)
{
animator.SetBool("move", false);
animator.SetBool("chase", true);
if (soundHurtPauseTimer > 0f)
{
StopAttackSound();
}
else
{
attackLoopSound.PlayLoop(true, 5f, 5f, 1f);
}
}
else
{
StopAttackSound();
animator.SetBool("chase", false);
}
if (controller.currentState == EnemyBird.State.Notice)
{
if (noticeImpulse)
{
animator.SetTrigger("notice");
noticeImpulse = false;
}
}
else
{
noticeImpulse = true;
}
currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Idle") && !animator.IsInTransition(0))
{
idleBreakerTimer += Time.deltaTime;
if (idleBreakerTimer > 5f)
{
idleBreakerTimer = 0f;
if (Random.Range(0, 100) < 35)
{
controller.IdleBreakerSet();
}
}
}
if (controller.idleBreakerTrigger)
{
animator.SetTrigger("idlebreak");
controller.idleBreakerTrigger = false;
}
if (controller.currentState == EnemyBird.State.Stun)
{
peckImpulse = false;
landImpulse = false;
if (stunImpulse)
{
animator.SetTrigger("stun");
stunImpulse = false;
}
animator.SetBool("stunned", true);
if (soundHurtPauseTimer > 0f)
{
stunSound.PlayLoop(false, 5f, 2f, 1f);
}
else
{
stunSound.PlayLoop(true, 5f, 5f, 1f);
}
}
else
{
animator.SetBool("stunned", false);
stunSound.PlayLoop(false, 5f, 1f, 1f);
if (!stunImpulse)
{
stunStopSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
stunImpulse = true;
}
}
if (controller.currentState == EnemyBird.State.Despawn)
{
animator.SetBool("despawning", true);
}
else
{
animator.SetBool("despawning", false);
}
if (controller.currentState == EnemyBird.State.FlyBackToNavmesh)
{
flyLoopSound.PlayLoop(true, 5f, 2f, 1f);
}
else
{
flyLoopSound.PlayLoop(false, 5f, 2f, 1f);
}
if (soundHurtPauseTimer > 0f)
{
soundHurtPauseTimer -= Time.deltaTime;
}
}
public void OnSpawn()
{
animator.Play("Spawn", 0, 0f);
}
private void Quack()
{
//IL_000d: 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)
quackSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
if ((!GameManager.Multiplayer() || PhotonNetwork.IsMasterClient) && controller.currentState != EnemyBird.State.Idle && controller.currentState != EnemyBird.State.Roam && controller.currentState != EnemyBird.State.Investigate && controller.currentState != EnemyBird.State.Leave && controller.currentState != EnemyBird.State.MoveBackToNavmesh)
{
EnemyDirector.instance.SetInvestigate(((Component)this).transform.position, 10f, false);
}
}
private void BiteSound()
{
//IL_0042: 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_008d: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer())
{
enemy.Rigidbody.GrabRelease(true, 0.1f);
}
GameDirector.instance.CameraShake.ShakeDistance(2f, 3f, 8f, ((Component)this).transform.position, 0.5f);
GameDirector.instance.CameraImpact.ShakeDistance(2f, 3f, 8f, ((Component)this).transform.position, 0.1f);
biteSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
}
private void TransformSound()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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)
if (((Behaviour)this).enabled)
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)Camera.main).transform.position) < 10f)
{
AudioScare.instance.PlayImpact();
}
transformSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
}
}
private void JumpSound()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
jumpSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
}
private void FootstepSound()
{
//IL_000d: 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_0046: Unknown result type (might be due to invalid IL or missing references)
footstepSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
Materials.Instance.Impulse(enemy.Rigidbody.physGrabObject.centerPoint, Vector3.down, (SoundType)0, true, true, material, (HostType)2);
}
private void MouthExtendSound()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
mouthExtendSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
}
private void MouthRetractSound()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
mouthRetractSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
}
private void StopAttackSound()
{
attackLoopSound.PlayLoop(false, 5f, 5f, 1f);
}
private void NoticeSound()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
noticeSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
}
private void FlyFlapSound()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
flyFlapSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
}
public void Despawn()
{
enemy.EnemyParent.Despawn();
}
}
[HarmonyPatch(typeof(PlayerController))]
internal static class ExamplePlayerControllerPatch
{
[HarmonyPrefix]
[HarmonyPatch("Start")]
private static void Start_Prefix(PlayerController __instance)
{
REPOBirdMod.Logger.LogDebug((object)$"{__instance} Start Prefix");
}
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void Start_Postfix(PlayerController __instance)
{
REPOBirdMod.Logger.LogDebug((object)$"{__instance} Start Postfix");
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Andraxis.REPOBirdMod", "REPOBirdMod", "1.0.0")]
public class REPOBirdMod : BaseUnityPlugin
{
internal static REPOBirdMod Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
string text = Path.Combine(directoryName, "repobird");
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
BundleLoader.LoadBundle(text, (Action<AssetBundle>)delegate(AssetBundle assetBundle)
{
EnemyContent val = assetBundle.LoadAsset<EnemyContent>("Enemy Bird");
Enemies.RegisterEnemy(val);
}, false);
}
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()
{
}
}
}