Decompiled source of DesaTest v1.0.0

DesaEnemies.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using DesaEnemies;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
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("Desay1")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DesaEnemies")]
[assembly: AssemblyTitle("DesaEnemies")]
[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;
		}
	}
}
public class Payayo : MonoBehaviour, IPunObservable
{
	public enum State
	{
		Spawn,
		Idle,
		Roam,
		Investigate,
		AttackStart,
		Attack,
		AttackEnd,
		MeleeStart,
		Melee,
		Seek,
		Leave,
		Stun,
		Despawn
	}

	public State currentState;

	public float stateTimer;

	private bool stateImpulse;

	private float stateTicker;

	internal Enemy enemy;

	internal PhotonView photonView;

	public PayayoAnim anim;

	public Transform aimVerticalTransform;

	public Transform hatTransform;

	public Transform bottomTransform;

	public SemiLaser laser;

	public Transform laserStartTransform;

	public Transform laserRayTransform;

	private Quaternion aimVerticalTarget;

	private Quaternion aimHorizontalTarget;

	public SpringQuaternion horizontalRotationSpring;

	private Quaternion horizontalRotationTarget = Quaternion.identity;

	[Space]
	public AnimationCurve aimHorizontalCurve;

	public float aimHorizontalSpread;

	public float aimHorizontalSpeed;

	private float aimHorizontalLerp;

	private float aimHorizontalResult;

	internal PlayerAvatar playerTarget;

	private Vector3 agentDestination;

	private Vector3 seekDestination;

	private Vector3 meleeTarget;

	private bool meleePlayer;

	private float laserCooldown;

	private float laserRange = 10f;

	private Vector3 hitPosition;

	private Vector3 hitPositionSmooth;

	private float hitPositionClientDistance;

	private bool hitPositionStartImpulse;

	private bool hitPositionImpact;

	private float hitPositionTimer;

	public ParticleSystem particleDeathSmoke;

	public ParticleSystem particleDeathBody;

	public ParticleSystem particleDeathNose;

	public ParticleSystem particleDeathHat;

	public ParticleSystem particleBottomSmoke;

	internal bool moveFast;

	private void Awake()
	{
		enemy = ((Component)this).GetComponent<Enemy>();
		photonView = ((Component)this).GetComponent<PhotonView>();
	}

	private void Update()
	{
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Invalid comparison between Unknown and I4
		VerticalAimLogic();
		LaserLogic();
		MoveFastLogic();
		if ((!GameManager.Multiplayer() || PhotonNetwork.IsMasterClient) && LevelGenerator.Instance.Generated)
		{
			if (enemy.IsStunned())
			{
				UpdateState(State.Stun);
			}
			if ((int)enemy.CurrentState == 11)
			{
				UpdateState(State.Despawn);
			}
			switch (currentState)
			{
			case State.Spawn:
				StateSpawn();
				break;
			case State.Idle:
				StateIdle();
				break;
			case State.Roam:
				StateRoam();
				break;
			case State.Investigate:
				StateInvestigate();
				break;
			case State.AttackStart:
				StateAttackStart();
				break;
			case State.Attack:
				StateAttack();
				break;
			case State.AttackEnd:
				StateAttackEnd();
				break;
			case State.MeleeStart:
				StateMeleeStart();
				break;
			case State.Melee:
				StateMelee();
				break;
			case State.Seek:
				StateSeek();
				break;
			case State.Leave:
				StateLeave();
				break;
			case State.Stun:
				StateStun();
				break;
			case State.Despawn:
				StateDespawn();
				break;
			}
			RotationLogic();
		}
	}

	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(4f, 8f);
			enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
			enemy.NavMeshAgent.ResetPath();
		}
		if (!SemiFunc.EnemySpawnIdlePause())
		{
			stateTimer -= Time.deltaTime;
			if (stateTimer <= 0f)
			{
				UpdateState(State.Roam);
			}
			if (SemiFunc.EnemyForceLeave(enemy))
			{
				UpdateState(State.Leave);
			}
		}
	}

	private void StateRoam()
	{
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: 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_007d: 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_008c: 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_00d6: 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)
		if (stateImpulse)
		{
			stateImpulse = false;
			stateTimer = 999f;
			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" })))
			{
				agentDestination = ((NavMeshHit)(ref val2)).position;
				flag = true;
			}
			if (!flag)
			{
				return;
			}
			enemy.Rigidbody.notMovingTimer = 0f;
			stateImpulse = false;
		}
		enemy.NavMeshAgent.SetDestination(agentDestination);
		if (!enemy.Jump.jumping && Vector3.Distance(((Component)this).transform.position, enemy.NavMeshAgent.GetPoint()) < 1f)
		{
			UpdateState(State.Idle);
		}
		else if (enemy.Rigidbody.notMovingTimer >= 3f)
		{
			AttackNearestPhysObjectOrGoToIdle();
		}
		if (SemiFunc.EnemyForceLeave(enemy))
		{
			UpdateState(State.Leave);
		}
	}

	private void StateInvestigate()
	{
		//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_0083: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
		if (stateImpulse)
		{
			stateImpulse = false;
			stateTimer = 999f;
			enemy.Rigidbody.notMovingTimer = 0f;
		}
		else
		{
			enemy.NavMeshAgent.SetDestination(agentDestination);
			if (!enemy.Jump.jumping && (Vector3.Distance(((Component)enemy.Rigidbody).transform.position, enemy.NavMeshAgent.GetPoint()) < 1f || Vector3.Distance(((Component)enemy.Rigidbody).transform.position, agentDestination) < 1f))
			{
				UpdateState(State.Idle);
			}
			else if (enemy.Rigidbody.notMovingTimer >= 3f)
			{
				AttackNearestPhysObjectOrGoToIdle();
			}
		}
		if (SemiFunc.EnemyForceLeave(enemy))
		{
			UpdateState(State.Leave);
		}
	}

	private void StateAttackStart()
	{
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: 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_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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)
		if (stateImpulse)
		{
			aimHorizontalResult = 0f;
			stateImpulse = false;
			stateTimer = 1f;
			enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
			enemy.NavMeshAgent.ResetPath();
			seekDestination = ((Component)playerTarget).transform.position;
			aimHorizontalLerp = 0f;
		}
		aimHorizontalResult = Mathf.Lerp(0f, 0f - aimHorizontalSpread, aimHorizontalCurve.Evaluate(aimHorizontalLerp));
		aimHorizontalLerp += 1.5f * Time.deltaTime;
		aimHorizontalTarget = Quaternion.LookRotation(playerTarget.PlayerVisionTarget.VisionTransform.position - ((Component)enemy.Rigidbody).transform.position);
		aimHorizontalTarget = Quaternion.Euler(0f, ((Quaternion)(ref aimHorizontalTarget)).eulerAngles.y, 0f);
		stateTimer -= Time.deltaTime;
		if (stateTimer <= 0f)
		{
			UpdateState(State.Attack);
		}
	}

	private void StateAttack()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		if (stateImpulse)
		{
			stateImpulse = false;
			stateTimer = 0.5f;
			enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
			enemy.NavMeshAgent.ResetPath();
			aimHorizontalLerp = 0f;
		}
		aimHorizontalResult = Mathf.Lerp(0f - aimHorizontalSpread, aimHorizontalSpread, aimHorizontalCurve.Evaluate(aimHorizontalLerp));
		aimHorizontalLerp += aimHorizontalSpeed * Time.deltaTime;
		if (aimHorizontalLerp >= 1f)
		{
			stateTimer -= Time.deltaTime;
			if (stateTimer <= 0f)
			{
				UpdateState(State.AttackEnd);
			}
		}
	}

	private void StateAttackEnd()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		if (stateImpulse)
		{
			stateImpulse = false;
			stateTimer = 2f;
			enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
			enemy.NavMeshAgent.ResetPath();
			aimHorizontalLerp = 0f;
		}
		aimHorizontalResult = Mathf.Lerp(aimHorizontalSpread, 0f, aimHorizontalCurve.Evaluate(aimHorizontalLerp));
		aimHorizontalLerp += 1.5f * Time.deltaTime;
		stateTimer -= Time.deltaTime;
		if (stateTimer <= 0f)
		{
			UpdateState(State.Seek);
		}
	}

	private void StateMeleeStart()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		if (stateImpulse)
		{
			stateImpulse = false;
			stateTimer = 0.5f;
			enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
			enemy.NavMeshAgent.ResetPath();
			seekDestination = meleeTarget;
		}
		if (meleePlayer)
		{
			meleeTarget = ((Component)playerTarget).transform.position;
			seekDestination = meleeTarget;
		}
		stateTimer -= Time.deltaTime;
		if (stateTimer <= 0f)
		{
			UpdateState(State.Melee);
		}
	}

	private void StateMelee()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		if (stateImpulse)
		{
			stateImpulse = false;
			stateTimer = 3f;
			enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
			enemy.NavMeshAgent.ResetPath();
		}
		stateTimer -= Time.deltaTime;
		if (stateTimer <= 0f)
		{
			UpdateState(State.Seek);
		}
	}

	private void StateSeek()
	{
		//IL_00a1: 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_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: 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)
		if (stateImpulse)
		{
			stateTimer = 20f;
			stateImpulse = false;
			enemy.Rigidbody.notMovingTimer = 0f;
			if (Vector3.Distance(((Component)this).transform.position, seekDestination) >= 3f)
			{
				moveFast = true;
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("MoveFastRPC", (RpcTarget)1, new object[1] { moveFast });
				}
			}
		}
		enemy.NavMeshAgent.SetDestination(seekDestination);
		if (moveFast)
		{
			enemy.NavMeshAgent.OverrideAgent(enemy.NavMeshAgent.DefaultSpeed * 2f, enemy.NavMeshAgent.DefaultAcceleration * 2f, 0.1f);
		}
		if (Vector3.Distance(((Component)this).transform.position, enemy.NavMeshAgent.GetPoint()) < 1f)
		{
			LevelPoint levelPointAhead = enemy.GetLevelPointAhead(seekDestination);
			if (Object.op_Implicit((Object)(object)levelPointAhead))
			{
				seekDestination = ((Component)levelPointAhead).transform.position;
			}
			if (moveFast)
			{
				moveFast = false;
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("MoveFastRPC", (RpcTarget)1, new object[1] { moveFast });
				}
			}
		}
		if (enemy.Rigidbody.notMovingTimer >= 3f)
		{
			AttackNearestPhysObjectOrGoToIdle();
			return;
		}
		stateTimer -= Time.deltaTime;
		if (stateTimer <= 0f)
		{
			UpdateState(State.Idle);
		}
	}

	public void StateLeave()
	{
		//IL_011d: 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_013e: 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_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)
		if (stateImpulse)
		{
			stateTimer = 999f;
			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 * 3f, 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)
			{
				return;
			}
			SemiFunc.EnemyLeaveStart(enemy);
			enemy.Rigidbody.notMovingTimer = 0f;
			stateImpulse = false;
		}
		enemy.NavMeshAgent.SetDestination(agentDestination);
		if (Vector3.Distance(((Component)this).transform.position, enemy.NavMeshAgent.GetPoint()) < 1f)
		{
			UpdateState(State.Idle);
		}
		else if (enemy.Rigidbody.notMovingTimer >= 3f)
		{
			AttackNearestPhysObjectOrGoToIdle();
		}
	}

	private void StateStun()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		if (stateImpulse)
		{
			stateImpulse = false;
			enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
			enemy.NavMeshAgent.ResetPath();
		}
		if (!enemy.IsStunned())
		{
			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 OnSpawn()
	{
		if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(enemy))
		{
			UpdateState(State.Spawn);
		}
	}

	public void OnVision()
	{
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: 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_0138: 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_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_01c5: 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)
		if (enemy.Jump.jumping)
		{
			return;
		}
		if (currentState == State.Roam || currentState == State.Idle || currentState == State.Seek || currentState == State.Leave || currentState == State.Investigate)
		{
			if ((Object)(object)playerTarget != (Object)(object)enemy.Vision.onVisionTriggeredPlayer)
			{
				playerTarget = enemy.Vision.onVisionTriggeredPlayer;
				if (GameManager.Multiplayer())
				{
					photonView.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { playerTarget.photonView.ViewID });
				}
			}
			if (playerTarget.isMoving || playerTarget.isCrouching || playerTarget.isCrawling)
			{
				if (Object.op_Implicit((Object)(object)playerTarget) && Vector3.Distance(((Component)this).transform.position, ((Component)playerTarget).transform.position) < 2.5f && Mathf.Abs(((Component)this).transform.position.y - ((Component)playerTarget).transform.position.y) < 1f)
				{
					meleeTarget = ((Component)playerTarget).transform.position;
					meleePlayer = true;
					UpdateState(State.MeleeStart);
				}
				else if (laserCooldown <= 0f)
				{
					UpdateState(State.AttackStart);
				}
				else
				{
					seekDestination = ((Component)playerTarget).transform.position;
					UpdateState(State.Seek);
				}
			}
		}
		else if ((currentState == State.AttackStart || currentState == State.Attack || currentState == State.AttackEnd) && (Object)(object)playerTarget == (Object)(object)enemy.Vision.onVisionTriggeredPlayer)
		{
			seekDestination = ((Component)playerTarget).transform.position;
		}
	}

	public void OnInvestigate()
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		if (SemiFunc.IsMasterClientOrSingleplayer() && (currentState == State.Idle || currentState == State.Roam || currentState == State.Seek || currentState == State.Investigate))
		{
			agentDestination = enemy.StateInvestigate.onInvestigateTriggeredPosition;
			UpdateState(State.Investigate);
		}
	}

	public void OnHurt()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		anim.soundHurt.Play(((Component)anim).transform.position, 1f, 1f, 1f, 1f);
		anim.soundHurtPauseTimer = 0.5f;
		if (SemiFunc.IsMasterClientOrSingleplayer() && currentState == State.Leave)
		{
			UpdateState(State.Idle);
		}
	}

	public void OnDeath()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: 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)
		anim.soundDeath.Play(((Component)anim).transform.position, 1f, 1f, 1f, 1f);
		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)particleDeathSmoke).transform.position = enemy.CenterTransform.position;
		particleDeathSmoke.Play();
		((Component)particleDeathBody).transform.position = enemy.CenterTransform.position;
		particleDeathBody.Play();
		((Component)particleDeathNose).transform.position = laserStartTransform.position;
		particleDeathNose.Play();
		((Component)particleDeathHat).transform.position = hatTransform.position;
		particleDeathHat.Play();
		if (SemiFunc.IsMasterClientOrSingleplayer())
		{
			enemy.EnemyParent.Despawn();
		}
	}

	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 (_state != currentState)
		{
			currentState = _state;
			stateImpulse = true;
			stateTimer = 0f;
			if (GameManager.Multiplayer())
			{
				photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { currentState });
			}
			else
			{
				UpdateStateRPC(currentState);
			}
		}
	}

	private void AttackNearestPhysObjectOrGoToIdle()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		meleeTarget = SemiFunc.EnemyGetNearestPhysObject(enemy);
		if (meleeTarget != Vector3.zero)
		{
			meleePlayer = false;
			UpdateState(State.Melee);
		}
		else
		{
			UpdateState(State.Idle);
		}
	}

	private void RotationLogic()
	{
		//IL_0043: 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_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: 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)
		//IL_0164: 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_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: 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_00e4: 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_00ff: 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_0266: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		if (currentState == State.AttackStart || currentState == State.Attack || currentState == State.AttackEnd)
		{
			float num = 10f * Mathf.Sin(stateTimer * 2f);
			horizontalRotationTarget = Quaternion.Euler(((Quaternion)(ref aimHorizontalTarget)).eulerAngles.x, ((Quaternion)(ref aimHorizontalTarget)).eulerAngles.y + aimHorizontalResult + num, ((Quaternion)(ref aimHorizontalTarget)).eulerAngles.z);
		}
		else if (currentState == State.MeleeStart)
		{
			if (Vector3.Distance(meleeTarget, ((Component)enemy.Rigidbody).transform.position) > 0.1f)
			{
				horizontalRotationTarget = Quaternion.LookRotation(meleeTarget - ((Component)enemy.Rigidbody).transform.position);
				((Quaternion)(ref horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref horizontalRotationTarget)).eulerAngles.y, 0f);
			}
		}
		else
		{
			Vector3 normalized = ((Vector3)(ref enemy.NavMeshAgent.AgentVelocity)).normalized;
			if (((Vector3)(ref normalized)).magnitude > 0.1f)
			{
				horizontalRotationTarget = Quaternion.LookRotation(((Vector3)(ref enemy.NavMeshAgent.AgentVelocity)).normalized);
				((Quaternion)(ref horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref horizontalRotationTarget)).eulerAngles.y, 0f);
			}
		}
		if (currentState == State.Spawn || currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate || currentState == State.Leave)
		{
			horizontalRotationSpring.speed = 5f;
			horizontalRotationSpring.damping = 0.7f;
		}
		else if (currentState == State.AttackStart || currentState == State.Attack || currentState == State.AttackEnd)
		{
			horizontalRotationSpring.speed = 15f;
			horizontalRotationSpring.damping = 0.8f;
		}
		else
		{
			horizontalRotationSpring.speed = 10f;
			horizontalRotationSpring.damping = 0.8f;
		}
		((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, horizontalRotationTarget, -1f);
	}

	private void VerticalAimLogic()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: 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_0080: 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_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_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00c5: 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_00a8: 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_00d6: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: 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_012a: Unknown result type (might be due to invalid IL or missing references)
		if (currentState != State.AttackStart && currentState != State.Attack && currentState != State.AttackEnd)
		{
			aimVerticalTarget = Quaternion.identity;
		}
		else if (currentState == State.AttackStart || (currentState != State.Attack && aimHorizontalLerp < 0.1f))
		{
			Quaternion val = Quaternion.LookRotation(playerTarget.PlayerVisionTarget.VisionTransform.position - laserRayTransform.position);
			if (aimVerticalTarget == Quaternion.identity)
			{
				aimVerticalTarget = val;
			}
			else
			{
				aimVerticalTarget = Quaternion.Lerp(aimVerticalTarget, val, 2f * Time.deltaTime);
			}
			Quaternion rotation = laserRayTransform.rotation;
			laserRayTransform.rotation = aimVerticalTarget;
			aimVerticalTarget = laserRayTransform.localRotation;
			aimVerticalTarget = Quaternion.Euler(laserRayTransform.eulerAngles.x, 0f, 0f);
			laserRayTransform.rotation = rotation;
		}
		aimVerticalTransform.localRotation = Quaternion.Lerp(aimVerticalTransform.localRotation, aimVerticalTarget, 20f * Time.deltaTime);
		laserRayTransform.localRotation = aimVerticalTarget;
	}

	private void LaserLogic()
	{
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: 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_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: 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_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: 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_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		if (currentState != State.Attack && currentState != State.AttackStart && currentState != State.AttackEnd)
		{
			laserCooldown -= Time.deltaTime;
		}
		if (currentState == State.Attack)
		{
			laserCooldown = 3f;
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				Transform val = laserStartTransform;
				Vector3 val2 = laserRayTransform.position - laserStartTransform.position;
				RaycastHit val3 = default(RaycastHit);
				if (Physics.Raycast(laserStartTransform.position, val2, ref val3, ((Vector3)(ref val2)).magnitude, LayerMask.GetMask(new string[1] { "Default" })))
				{
					val = laserRayTransform;
				}
				else if (Physics.OverlapSphere(laserStartTransform.position, 0.25f, LayerMask.GetMask(new string[1] { "Default" })).Length != 0)
				{
					val = laserRayTransform;
				}
				if (hitPositionTimer <= 0f)
				{
					hitPositionTimer = 0.05f;
					RaycastHit val4 = default(RaycastHit);
					if (Physics.Raycast(val.position, val.forward, ref val4, laserRange, LayerMask.GetMask(new string[1] { "Default" })))
					{
						hitPosition = ((RaycastHit)(ref val4)).point;
						hitPositionImpact = true;
					}
					else
					{
						hitPosition = val.position + val.forward * laserRange;
						hitPositionImpact = false;
					}
				}
				else
				{
					hitPositionTimer -= Time.deltaTime;
				}
				hitPositionSmooth = Vector3.Lerp(hitPositionSmooth, hitPosition, 20f * Time.deltaTime);
			}
			else
			{
				hitPositionSmooth = Vector3.MoveTowards(hitPositionSmooth, hitPosition, hitPositionClientDistance * Time.deltaTime * ((float)PhotonNetwork.SerializationRate * 0.8f));
			}
			if (hitPositionStartImpulse)
			{
				hitPositionSmooth = hitPosition;
				hitPositionStartImpulse = false;
			}
			Vector3 val5 = laserRayTransform.position - hitPosition;
			Vector3 val6 = laserRayTransform.position - hitPositionSmooth;
			if (((Vector3)(ref val5)).magnitude < ((Vector3)(ref val6)).magnitude)
			{
				val6 = Vector3.ClampMagnitude(val6, ((Vector3)(ref val5)).magnitude);
				hitPositionSmooth = laserRayTransform.position - val6;
			}
			laser.LaserActive(laserStartTransform.position, hitPositionSmooth, hitPositionImpact);
		}
		else
		{
			hitPositionTimer = 0f;
			hitPositionStartImpulse = true;
		}
	}

	private void MoveFastLogic()
	{
		if (currentState != State.Seek && moveFast)
		{
			moveFast = false;
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("MoveFastRPC", (RpcTarget)1, new object[1] { moveFast });
			}
		}
	}

	[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;
		}
	}

	[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 MeleeTriggerRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		if (SemiFunc.MasterOnlyRPC(_info))
		{
			anim.meleeImpulse = true;
		}
	}

	[PunRPC]
	private void MoveFastRPC(bool _moveFast, PhotonMessageInfo _info = default(PhotonMessageInfo))
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		if (SemiFunc.MasterOnlyRPC(_info))
		{
			moveFast = _moveFast;
		}
	}

	public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: 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_0089: 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_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		if (SemiFunc.MasterOnlyRPC(info))
		{
			if (stream.IsWriting)
			{
				stream.SendNext((object)aimVerticalTarget);
				stream.SendNext((object)hitPosition);
				stream.SendNext((object)hitPositionImpact);
			}
			else
			{
				aimVerticalTarget = (Quaternion)stream.ReceiveNext();
				hitPosition = (Vector3)stream.ReceiveNext();
				hitPositionImpact = (bool)stream.ReceiveNext();
				hitPositionClientDistance = Vector3.Distance(hitPositionSmooth, hitPosition);
			}
		}
	}
}
public class PayayoAnim : MonoBehaviour
{
	public Enemy enemy;

	public Payayo controller;

	public bool noseEmission;

	private Animator animator;

	private int animSpawn = Animator.StringToHash("spawn");

	private int animDespawning = Animator.StringToHash("despawning");

	private int animStun = Animator.StringToHash("stun");

	private int animStunned = Animator.StringToHash("stunned");

	private int animMoving = Animator.StringToHash("moving");

	private int animMovingFast = Animator.StringToHash("movingFast");

	private int animJump = Animator.StringToHash("jump");

	private int animFalling = Animator.StringToHash("falling");

	private int animLand = Animator.StringToHash("land");

	private int animMelee = Animator.StringToHash("melee");

	private int animAttacking = Animator.StringToHash("attacking");

	private int animAttack = Animator.StringToHash("attack");

	public float springSpeedMultiplier;

	public float springDampingMultiplier;

	[Space]
	public SpringQuaternion springNose01;

	private float springNose01Speed;

	private float springNose01Damping;

	public Transform springNose01Target;

	public Transform springNose01Source;

	public SpringQuaternion springNose02;

	private float springNose02Speed;

	private float springNose02Damping;

	public Transform springNose02Target;

	public Transform springNose02Source;

	public SpringQuaternion springNose03;

	private float springNose03Speed;

	private float springNose03Damping;

	public Transform springNose03Target;

	public Transform springNose03Source;

	private float moveTimer;

	private bool spawnImpulse = true;

	private bool stunImpulse = true;

	private bool stunEndImpulse;

	private bool jumpImpulse = true;

	private bool landImpulse = true;

	internal bool meleeImpulse = true;

	private bool attackImpulse = true;

	private Color emissionColor = Color.black;

	private Color emissionColorPrevious = Color.black;

	internal MaterialTrigger material = new MaterialTrigger();

	internal float soundHurtPauseTimer;

	public Sound soundMoveShort;

	public Sound soundMoveLong;

	[Space]
	public Sound soundFootstepSmall;

	public Sound soundFootstepBig;

	public Sound soundFootstepHuge;

	[Space]
	public Sound soundStunIntro;

	public Sound soundStunLoop;

	public Sound soundStunOutro;

	[Space]
	public Sound soundJump;

	public Sound soundLand;

	[Space]
	public Sound soundMeleeTell;

	public Sound soundMeleeKick;

	[Space]
	public bool soundAttackLoopActive;

	public Sound soundAttackIntro;

	public Sound soundAttackLoop;

	public Sound soundAttackOutro;

	[Space]
	public Sound soundHurt;

	public Sound soundDeath;

	private void Awake()
	{
		animator = ((Component)this).GetComponent<Animator>();
		animator.keepAnimatorStateOnDisable = true;
		springNose01Speed = springNose01.speed;
		springNose01Damping = springNose01.damping;
		springNose02Speed = springNose02.speed;
		springNose02Damping = springNose02.damping;
		springNose03Speed = springNose03.speed;
		springNose03Damping = springNose03.damping;
	}

	private void Update()
	{
		//IL_012a: 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_01bc: 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_01d1: 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_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_01ac: 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_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: 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_02cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: 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_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		if (enemy.Rigidbody.frozen)
		{
			animator.speed = 0f;
		}
		else
		{
			animator.speed = 1f;
		}
		if (controller.currentState == Payayo.State.Stun)
		{
			if (stunImpulse)
			{
				soundStunIntro.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
				animator.SetTrigger(animStun);
				stunImpulse = false;
			}
			animator.SetBool(animStunned, true);
			if (soundHurtPauseTimer > 0f)
			{
				soundStunLoop.PlayLoop(false, 5f, 5f, 1f);
			}
			else
			{
				soundStunLoop.PlayLoop(true, 5f, 5f, 1f);
			}
			stunEndImpulse = true;
		}
		else
		{
			if (stunEndImpulse)
			{
				soundStunOutro.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
				stunEndImpulse = false;
			}
			animator.SetBool(animStunned, false);
			soundStunLoop.PlayLoop(false, 5f, 5f, 1f);
			stunImpulse = true;
		}
		if (noseEmission)
		{
			emissionColor = Color.Lerp(emissionColor, Color.white, Time.deltaTime * 10f);
		}
		else
		{
			emissionColor = Color.Lerp(emissionColor, Color.black, Time.deltaTime * 10f);
		}
		if (emissionColor != emissionColorPrevious)
		{
			emissionColorPrevious = emissionColor;
			enemy.Health.instancedMaterials[0].SetColor("_EmissionColor", emissionColor);
		}
		springNose01.speed = springNose01Speed * springSpeedMultiplier;
		springNose01.damping = springNose01Damping * springDampingMultiplier;
		springNose01Source.rotation = SemiFunc.SpringQuaternionGet(springNose01, ((Component)springNose01Target).transform.rotation, -1f);
		springNose02.speed = springNose02Speed * springSpeedMultiplier;
		springNose02.damping = springNose02Damping * springDampingMultiplier;
		springNose02Source.rotation = SemiFunc.SpringQuaternionGet(springNose02, ((Component)springNose02Target).transform.rotation, -1f);
		springNose03.speed = springNose03Speed * springSpeedMultiplier;
		springNose03.damping = springNose03Damping * springDampingMultiplier;
		springNose03Source.rotation = SemiFunc.SpringQuaternionGet(springNose03, ((Component)springNose03Target).transform.rotation, -1f);
		if (SemiFunc.IsMasterClientOrSingleplayer())
		{
			if (!enemy.Jump.jumping && !enemy.IsStunned() && (controller.currentState == Payayo.State.MeleeStart || controller.currentState == Payayo.State.Melee))
			{
				if (meleeImpulse)
				{
					if (SemiFunc.IsMultiplayer())
					{
						controller.photonView.RPC("MeleeTriggerRPC", (RpcTarget)1, Array.Empty<object>());
					}
					animator.SetTrigger(animMelee);
					meleeImpulse = false;
				}
			}
			else
			{
				meleeImpulse = true;
			}
		}
		else if (meleeImpulse)
		{
			animator.SetTrigger(animMelee);
			meleeImpulse = false;
		}
		if (controller.currentState == Payayo.State.AttackStart || controller.currentState == Payayo.State.Attack)
		{
			if (attackImpulse)
			{
				attackImpulse = false;
				animator.SetTrigger(animAttack);
			}
			animator.SetBool(animAttacking, true);
		}
		else
		{
			attackImpulse = true;
			animator.SetBool(animAttacking, false);
		}
		if (soundHurtPauseTimer > 0f)
		{
			soundAttackLoop.PlayLoop(false, 5f, 5f, 1f);
		}
		else
		{
			soundAttackLoop.PlayLoop(soundAttackLoopActive, 5f, 5f, 1f);
		}
		if ((controller.currentState == Payayo.State.Roam || controller.currentState == Payayo.State.Investigate || controller.currentState == Payayo.State.Seek || controller.currentState == Payayo.State.Leave) && (((Vector3)(ref enemy.Rigidbody.velocity)).magnitude > 0.5f || ((Vector3)(ref enemy.Rigidbody.physGrabObject.rbAngularVelocity)).magnitude > 5f))
		{
			moveTimer = 0.25f;
		}
		if (moveTimer > 0f)
		{
			moveTimer -= Time.deltaTime;
			animator.SetBool(animMoving, true);
		}
		else
		{
			animator.SetBool(animMoving, false);
		}
		animator.SetBool(animMovingFast, controller.moveFast);
		if (enemy.Jump.jumping || enemy.Jump.jumpingDelay)
		{
			if (jumpImpulse)
			{
				if (!enemy.IsStunned())
				{
					animator.SetTrigger(animJump);
				}
				animator.SetBool(animFalling, false);
				jumpImpulse = false;
				landImpulse = true;
			}
			else if (controller.enemy.Rigidbody.physGrabObject.rbVelocity.y < -0.5f)
			{
				animator.SetBool(animFalling, true);
			}
		}
		else
		{
			if (landImpulse)
			{
				if (!enemy.IsStunned())
				{
					animator.SetTrigger(animLand);
				}
				moveTimer = 0f;
				landImpulse = false;
			}
			animator.SetBool(animFalling, false);
			jumpImpulse = true;
		}
		if (controller.currentState == Payayo.State.Spawn)
		{
			if (spawnImpulse)
			{
				spawnImpulse = false;
				animator.SetTrigger(animSpawn);
			}
		}
		else
		{
			spawnImpulse = true;
		}
		if (controller.currentState == Payayo.State.Despawn)
		{
			animator.SetBool(animDespawning, true);
		}
		else
		{
			animator.SetBool(animDespawning, false);
		}
		if (soundHurtPauseTimer > 0f)
		{
			soundHurtPauseTimer -= Time.deltaTime;
		}
	}

	public void Despawn()
	{
		enemy.EnemyParent.Despawn();
	}

	public void FootstepSmall()
	{
		//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)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		soundFootstepSmall.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
		Materials.Instance.Impulse(enemy.Rigidbody.physGrabObject.centerPoint + Vector3.down * 0.5f, Vector3.down, (SoundType)0, false, false, material, (HostType)2);
	}

	public void FootstepBig()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: 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)
		GameDirector.instance.CameraShake.ShakeDistance(2f, 5f, 10f, ((Component)this).transform.position, 0.25f);
		GameDirector.instance.CameraImpact.ShakeDistance(2f, 5f, 10f, ((Component)this).transform.position, 0.1f);
		soundFootstepBig.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
		Materials.Instance.Impulse(enemy.Rigidbody.physGrabObject.centerPoint + Vector3.down * 0.5f, Vector3.down, (SoundType)2, false, false, material, (HostType)2);
	}

	public void FootstepHuge()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: 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)
		GameDirector.instance.CameraShake.ShakeDistance(2.5f, 5f, 15f, ((Component)this).transform.position, 0.25f);
		GameDirector.instance.CameraImpact.ShakeDistance(2.5f, 5f, 15f, ((Component)this).transform.position, 0.1f);
		soundFootstepHuge.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
		Materials.Instance.Impulse(enemy.Rigidbody.physGrabObject.centerPoint + Vector3.down * 0.5f, Vector3.down, (SoundType)2, false, false, material, (HostType)2);
	}

	public void Jump()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: 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_00e5: 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)
		((Component)controller.particleBottomSmoke).transform.position = controller.bottomTransform.position;
		controller.particleBottomSmoke.Play();
		soundJump.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
		GameDirector.instance.CameraShake.ShakeDistance(5f, 5f, 10f, ((Component)this).transform.position, 0.5f);
		GameDirector.instance.CameraImpact.ShakeDistance(5f, 5f, 10f, ((Component)this).transform.position, 0.1f);
		Materials.Instance.Impulse(enemy.Rigidbody.physGrabObject.centerPoint + Vector3.down * 0.5f, Vector3.down, (SoundType)2, false, false, material, (HostType)2);
	}

	public void Land()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: 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_00e5: 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)
		((Component)controller.particleBottomSmoke).transform.position = controller.bottomTransform.position;
		controller.particleBottomSmoke.Play();
		soundLand.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
		GameDirector.instance.CameraShake.ShakeDistance(5f, 5f, 10f, ((Component)this).transform.position, 0.5f);
		GameDirector.instance.CameraImpact.ShakeDistance(5f, 5f, 10f, ((Component)this).transform.position, 0.1f);
		Materials.Instance.Impulse(enemy.Rigidbody.physGrabObject.centerPoint + Vector3.down * 0.5f, Vector3.down, (SoundType)2, false, false, material, (HostType)2);
	}

	public void MoveShort()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		soundMoveShort.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void MoveLong()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		soundMoveLong.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void MeleeTell()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		soundMeleeTell.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void MeleeKick()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		soundMeleeKick.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void AttackIntro()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		soundAttackIntro.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void AttackOutro()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		soundAttackOutro.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}
}
public class PibePlateadoAnim : MonoBehaviour
{
	public Enemy enemy;

	public PibePlateado enemyBirthdayBoy;

	[HideInInspector]
	public Animator animator;

	public Transform leftEyePivot;

	public Transform rightEyePivot;

	public PlayerAvatar lookTarget;

	public Rigidbody rb;

	public Transform headPivot;

	public SpringQuaternion topHairRightSpring = new SpringQuaternion();

	public Transform topHairRightTransform;

	public Transform topHairRightTarget;

	[Space]
	public SpringQuaternion topHairLeftSpring = new SpringQuaternion();

	public Transform topHairLeftTransform;

	public Transform topHairLeftTarget;

	[Space]
	public SpringQuaternion sideHairLeftSpring = new SpringQuaternion();

	public Transform sideHairLeftTransform;

	public Transform sideHairLeftTarget;

	[Space]
	public SpringQuaternion sideHairRightSpring = new SpringQuaternion();

	public Transform sideHairRightTransform;

	public Transform sideHairRightTarget;

	[Space]
	public SpringQuaternion middleHairSpring = new SpringQuaternion();

	public Transform middleHairTransform;

	public Transform middleHairTarget;

	[Space]
	public SpringQuaternion BackHairSpring = new SpringQuaternion();

	public Transform BackHairTransform;

	public Transform BackHairTarget;

	public ParticleSystem spawnSmokeParticle;

	public ParticleSystem runningSpitParticle;

	public ParticleSystem balloonPopParticle;

	public GameObject deathParticlePrefab;

	public ParticleSystem droolParticle;

	public ParticleSystem runningSmokeParticle;

	internal MaterialTrigger material = new MaterialTrigger();

	private bool noticed;

	private bool floating;

	public bool breaker;

	private Quaternion prevHeadLookRotation;

	private Quaternion prevRigidBodyRotation;

	private float moveSoundRigidBodyTimer;

	private float moveSoundHeadTimer;

	public Sound footStepSound;

	public Sound footStepGlobalSound;

	public Sound footStepHardSound;

	public Sound balloonSqueakSound;

	public Sound moveLightSound;

	public Sound moveHeavySound;

	public Sound balloonPopSound;

	public Sound balloonBlowSound;

	public Sound balloonTieSound;

	[Space]
	public Sound deathSound;

	public Sound hurtSound;

	public Sound idleLoop;

	public Sound runLoop;

	public Sound aggroLoop;

	public Sound idleBreaker;

	public List<AudioClip> idleBreakers;

	public Sound attackSwoosh;

	public Sound jumpSound;

	public Sound landSound;

	public Sound inhaleSound;

	public Sound noticeSound;

	public Sound crackSound;

	public Sound balloonPopGlobal;

	private static readonly int animDespawn = Animator.StringToHash("despawn");

	private static readonly int animDespawnTrigger = Animator.StringToHash("despawn_trigger");

	private static readonly int animFloat = Animator.StringToHash("float");

	private static readonly int animFloatTrigger = Animator.StringToHash("float_trigger");

	private void Awake()
	{
		animator = ((Component)this).GetComponent<Animator>();
		animator.keepAnimatorStateOnDisable = true;
	}

	private void LateUpdate()
	{
		//IL_0125: 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_013a: 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_0166: 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_00ad: 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_00c5: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: 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_00e9: 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)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: 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_0096: Unknown result type (might be due to invalid IL or missing references)
		if (enemyBirthdayBoy.currentState == PibePlateado.State.CreepyStare || enemyBirthdayBoy.currentState == PibePlateado.State.Attack || enemyBirthdayBoy.currentState == PibePlateado.State.AttackOver || enemyBirthdayBoy.currentState == PibePlateado.State.AttackUnder)
		{
			PlayerAvatar val = ((!Object.op_Implicit((Object)(object)enemyBirthdayBoy.playerTarget)) ? lookTarget : enemyBirthdayBoy.playerTarget);
			if (Object.op_Implicit((Object)(object)val))
			{
				Vector3 val2 = ((!SemiFunc.IsMultiplayer() || val.isLocal) ? ((Component)val.localCamera).transform.position : val.playerAvatarVisuals.headLookAtTransform.position);
				val2.y -= 0.3f;
				Quaternion rotation = Quaternion.LookRotation(val2 - leftEyePivot.position, Vector3.up);
				leftEyePivot.rotation = rotation;
				Quaternion rotation2 = Quaternion.LookRotation(val2 - rightEyePivot.position, Vector3.up);
				rightEyePivot.rotation = rotation2;
			}
		}
		else
		{
			leftEyePivot.localRotation = Quaternion.Slerp(leftEyePivot.localRotation, Quaternion.identity, Time.deltaTime * 5f);
			rightEyePivot.localRotation = Quaternion.Slerp(rightEyePivot.localRotation, Quaternion.identity, Time.deltaTime * 5f);
		}
	}

	private void Update()
	{
		//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04eb: Invalid comparison between Unknown and I4
		TurnSoundLogic();
		AnimateSprings();
		bool flag = enemyBirthdayBoy.AttackState() || enemyBirthdayBoy.currentState == PibePlateado.State.GoToPlayerAngry || enemyBirthdayBoy.currentState == PibePlateado.State.GoToBalloonAngry;
		bool flag2 = (((Vector3)(ref enemy.Rigidbody.velocity)).magnitude > 0.1f || ((Vector3)(ref enemy.Rigidbody.physGrabObject.rbAngularVelocity)).magnitude > 0.5f || enemy.IsStunned()) && enemyBirthdayBoy.currentState != PibePlateado.State.Idle && enemyBirthdayBoy.currentState != PibePlateado.State.PlaceBalloon && !flag;
		bool flag3 = enemyBirthdayBoy.currentState != PibePlateado.State.PlaceBalloon && enemyBirthdayBoy.currentState != PibePlateado.State.PlayerNotice && enemyBirthdayBoy.currentState != PibePlateado.State.Despawn && !flag && !flag2 && !breaker;
		runLoop.PlayLoop(flag2, 1f, 1f, 1f);
		idleLoop.PlayLoop(flag3, 1f, 1f, 1f);
		aggroLoop.PlayLoop(flag, 1f, 1f, 1f);
		if (flag2 || enemyBirthdayBoy.currentState == PibePlateado.State.GoToPlayerAngry || enemyBirthdayBoy.currentState == PibePlateado.State.GoToBalloonAngry)
		{
			animator.SetBool("move", true);
		}
		else
		{
			animator.SetBool("move", false);
		}
		if (enemyBirthdayBoy.currentState == PibePlateado.State.Attack && ((Vector3)(ref enemy.Rigidbody.velocity)).magnitude > 1f && !enemy.Jump.jumping && !enemy.Jump.jumpingDelay && !enemy.Jump.landDelay)
		{
			if (!runningSmokeParticle.isPlaying)
			{
				runningSmokeParticle.Play(true);
			}
		}
		else if (runningSmokeParticle.isPlaying)
		{
			runningSmokeParticle.Stop(true);
		}
		if (enemyBirthdayBoy.currentState == PibePlateado.State.Attack)
		{
			if (!runningSpitParticle.isPlaying)
			{
				runningSpitParticle.Play();
			}
		}
		else if (runningSpitParticle.isPlaying)
		{
			runningSpitParticle.Stop();
		}
		if (enemyBirthdayBoy.currentState == PibePlateado.State.Attack || enemyBirthdayBoy.currentState == PibePlateado.State.AttackUnder || enemyBirthdayBoy.currentState == PibePlateado.State.AttackOver)
		{
			animator.SetBool("attack", true);
		}
		else
		{
			animator.SetBool("attack", false);
		}
		if (enemy.IsStunned())
		{
			animator.SetBool("stun", true);
		}
		else
		{
			animator.SetBool("stun", false);
		}
		if (!enemy.IsStunned() && (enemy.Jump.jumping || enemy.Jump.jumpingDelay))
		{
			animator.SetBool("jump", true);
		}
		else
		{
			animator.SetBool("jump", false);
		}
		if (enemyBirthdayBoy.currentState == PibePlateado.State.AttackUnderStart || enemyBirthdayBoy.currentState == PibePlateado.State.AttackUnder || enemyBirthdayBoy.currentState == PibePlateado.State.AttackUnderEnd)
		{
			animator.SetBool("crawl", true);
		}
		else
		{
			animator.SetBool("crawl", false);
		}
		if (enemyBirthdayBoy.currentState == PibePlateado.State.PlayerNotice && !noticed)
		{
			animator.SetTrigger("player_notice");
			noticed = true;
		}
		else if (enemyBirthdayBoy.currentState != PibePlateado.State.PlayerNotice)
		{
			noticed = false;
		}
		if (enemyBirthdayBoy.currentState == PibePlateado.State.FlyBackUp || enemyBirthdayBoy.currentState == PibePlateado.State.FlyBackToNavMesh)
		{
			if (!animator.GetBool(animFloat))
			{
				animator.SetTrigger(animFloatTrigger);
			}
			animator.SetBool(animFloat, true);
		}
		else
		{
			animator.SetBool(animFloat, false);
		}
		if (enemyBirthdayBoy.currentState == PibePlateado.State.Despawn || (int)enemy.CurrentState == 11)
		{
			if (!animator.GetBool(animDespawn))
			{
				animator.ResetTrigger(animFloatTrigger);
				animator.ResetTrigger("stun_trigger");
				droolParticle.Stop();
				spawnSmokeParticle.Play();
				animator.SetTrigger(animDespawnTrigger);
			}
			animator.SetBool(animDespawn, true);
		}
		else
		{
			animator.SetBool(animDespawn, false);
			if (!droolParticle.isPlaying)
			{
				droolParticle.Play();
			}
		}
	}

	private void AnimateSprings()
	{
		//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_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: 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_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: 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_00d6: 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)
		topHairRightTransform.rotation = SemiFunc.SpringQuaternionGet(topHairRightSpring, topHairRightTarget.rotation, -1f);
		topHairLeftTransform.rotation = SemiFunc.SpringQuaternionGet(topHairLeftSpring, topHairLeftTarget.rotation, -1f);
		sideHairLeftTransform.rotation = SemiFunc.SpringQuaternionGet(sideHairLeftSpring, sideHairLeftTarget.rotation, -1f);
		sideHairRightTransform.rotation = SemiFunc.SpringQuaternionGet(sideHairRightSpring, sideHairRightTarget.rotation, -1f);
		middleHairTransform.rotation = SemiFunc.SpringQuaternionGet(middleHairSpring, middleHairTarget.rotation, -1f);
		BackHairTransform.rotation = SemiFunc.SpringQuaternionGet(BackHairSpring, BackHairTarget.rotation, -1f);
	}

	public void BlowBalloonAnimationTrigger()
	{
		animator.SetTrigger("blow_balloon_trigger");
	}

	public void DoneWithBalloonBlow()
	{
		enemyBirthdayBoy.OnBalloonBlowComplete();
	}

	public void StoreBalloonLocation()
	{
		enemyBirthdayBoy.StoreBalloonLocation();
	}

	public void SetBlowingFalse()
	{
		enemyBirthdayBoy.blowing = false;
	}

	public void SetBlowingTrue()
	{
		enemyBirthdayBoy.blowing = true;
	}

	public void SetSpawn()
	{
		animator.Play("Birthday Boy - Spawn", 0, 0f);
		spawnSmokeParticle.Play();
	}

	public void SetDespawn()
	{
		enemy.EnemyParent.Despawn();
	}

	public void CrouchedDown()
	{
		enemyBirthdayBoy.CrouchedDown();
	}

	public void FootStepSound()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		footStepSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
		MaterialSound();
		if (enemyBirthdayBoy.AttackState())
		{
			footStepSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			footStepHardSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
		}
	}

	public void MoveLightSound()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		moveLightSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void MoveHeavySound()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		moveHeavySound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void BalloonSqueakSound()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		balloonSqueakSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void InterruptBalloonPop()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		balloonPopParticle.Play(true);
		balloonPopSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void BalloonBloWSound()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		balloonBlowSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void BalloonTieSound()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		balloonTieSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	private void MaterialSound()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		Materials.Instance.Impulse(enemy.Rigidbody.physGrabObject.centerPoint + Vector3.down * 0.5f, Vector3.down, (SoundType)0, true, true, material, (HostType)2);
	}

	private void TurnSoundLogic()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: 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_004f: 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_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		if (SemiFunc.FPSImpulse5())
		{
			if (Quaternion.Angle(prevHeadLookRotation, headPivot.rotation) > 30f && moveSoundHeadTimer <= 0f)
			{
				moveLightSound.Play(headPivot.position, 1f, 1f, 1f, 1f);
				prevHeadLookRotation = headPivot.rotation;
				moveSoundHeadTimer = 0.2f;
			}
			if (Quaternion.Angle(prevRigidBodyRotation, rb.rotation) > 20f && moveSoundRigidBodyTimer <= 0f)
			{
				moveSoundRigidBodyTimer = 0.5f;
				moveHeavySound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
				prevRigidBodyRotation = rb.rotation;
			}
			prevHeadLookRotation = headPivot.rotation;
			prevRigidBodyRotation = rb.rotation;
		}
		if (moveSoundRigidBodyTimer > 0f)
		{
			moveSoundRigidBodyTimer -= Time.deltaTime;
		}
		if (moveSoundHeadTimer > 0f)
		{
			moveSoundHeadTimer -= Time.deltaTime;
		}
	}

	public void PlayDeathParticles()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		Object.Instantiate<GameObject>(deathParticlePrefab, ((Component)this).transform.position, Quaternion.identity).GetComponent<ParticleSystem>().Play(true);
	}

	public void AttackSwoosh()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		attackSwoosh.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public 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);
	}

	public void LandSound()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		landSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public void InhaleSound()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		inhaleSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}

	public 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);
	}

	public void CrackSound()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		crackSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
	}
}
namespace DesaEnemies
{
	[BepInPlugin("Desay1.DesaEnemies", "DesaEnemies", "1.0")]
	public class DesaEnemies : BaseUnityPlugin
	{
		internal static DesaEnemies 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();
			Logger.LogInfo((object)"DesaTest has loaded!");
		}

		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()
		{
		}
	}
	[HarmonyPatch(typeof(PlayerController))]
	internal static class ExamplePlayerControllerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void Start_Prefix(PlayerController __instance)
		{
			DesaEnemies.Logger.LogDebug((object)$"{__instance} Start Prefix");
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(PlayerController __instance)
		{
			DesaEnemies.Logger.LogDebug((object)$"{__instance} Start Postfix");
		}
	}
	public class PibePlateado : MonoBehaviour
	{
		public enum State
		{
			Spawn,
			Despawn,
			Idle,
			GoToBalloonPlacement,
			PlaceBalloon,
			LeaveAfterBalloon,
			GoToPlayerAngry,
			GoToBalloonAngry,
			PlayerNotice,
			LookAround,
			SeekPlayer,
			Investigate,
			CreepyStare,
			Attack,
			AttackUnderStart,
			AttackUnder,
			AttackUnderEnd,
			StandUp,
			AttackOver,
			Leave,
			Stunned,
			FlyBackUp,
			FlyBackToNavMesh
		}

		[HideInInspector]
		public State currentState;

		[Header("Scripts & Components")]
		public PibePlateadoAnim anim;

		public EnemyParent enemyParent;

		[Header("Balloon Placement")]
		public int maxBalloons = 30;

		public GameObject balloonPrefab;

		public List<Transform> balloonSpawnPoints;

		[Header("Collision Checkers")]
		public Transform balloonCollisionChecker;

		public Transform standUpCollisionChecker;

		public Transform doorCollisionChecker;

		[Header("Collider")]
		public CapsuleCollider BBcollider;

		public CapsuleCollider colliderSmall;

		[Header("Code Anim components")]
		public Transform visualMesh;

		public Transform headPivot;

		public Transform leftEyePivot;

		public Transform rightEyePivot;

		public Transform bottom;

		public Transform animatingBalloon;

		[Header("Rotation Logic")]
		private Quaternion horizontalRotationTarget = Quaternion.identity;

		public SpringQuaternion horizontalRotationSpring;

		public GameObject balloonPopEffect;

		[HideInInspector]
		public bool blowing;

		[HideInInspector]
		public PlayerAvatar playerTarget;

		private State previousState;

		private Enemy enemy;

		private PhotonView photonView;

		public Dictionary<Vector3, GameObject> balloons = new Dictionary<Vector3, GameObject>();

		private List<Vector3> balloonsToRemove = new List<Vector3>();

		private List<int> balloonPlacements;

		private float stateTimer;

		private float secondStateTimer;

		private float thirdStateTimer;

		private float popAggroRadius = 10f;

		private float stateTimerClient;

		private float balloonInterval = 3f;

		private float onScreenTimer;

		private float creepyStareTimer;

		private float maxHeadRotationUpDown = 40f;

		private float maxHeadRotationLeftRight = 70f;

		private float idleBreakerTimer;

		private float breakerPlayTime = 2f;

		private float breakerPlayTimer;

		private float preferredBalloonDistance = 1.8f;

		private bool stateImpulse;

		private bool startOfStateClient;

		private bool SkipStateImpulse;

		private bool nonAggroInvestigate;

		private bool hasPendingBalloon;

		private bool checkedForDuplicates;

		private bool replaceOldBalloons;

		private bool onNavMesh;

		private bool playerOnNavMesh;

		private bool angrySpawn;

		private Vector3 targetPosition;

		private Vector3 stuckAttackTarget;

		private Vector3 agentDestination;

		private Vector3 moveBackPosition;

		private Vector3 pendingBalloonPoint;

		private Vector3 bPos;

		private Vector3 bScale;

		private int minBalloonsPerPlacement = 2;

		private int maxBalloonsPerPlacement = 5;

		private int balloonCount;

		private int balloonsPlaced;

		private int balloonsPlacedTotal;

		private int myIndex;

		private ParticleScriptExplosion particleScriptExplosion;

		private Color[] colors = (Color[])(object)new Color[7]
		{
			new Color(0.5f, 0.5f, 0.5f),
			new Color(0.66f, 0.66f, 0.66f),
			new Color(0.18f, 0.31f, 0.31f),
			new Color(0.41f, 0.41f, 0.41f),
			new Color(0.83f, 0.83f, 0.83f),
			new Color(0.47f, 0.53f, 0.6f),
			new Color(0.44f, 0.5f, 0.56f)
		};

		private Color balloonColor = new Color(0.75f, 0.75f, 0.75f);

		private void Awake()
		{
			enemy = ((Component)this).GetComponent<Enemy>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
		}

		private void FixedUpdate()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				enemy.Rigidbody.gravity = !FlyState();
				if (currentState != State.FlyBackUp)
				{
				}
			}
		}

		private void Update()
		{
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Invalid comparison between Unknown and I4
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: 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_0250: Unknown result type (might be due to invalid IL or missing references)
			stateTimerClient += Time.deltaTime;
			CheckForStartOfStateClient();
			BodyRotationLogic();
			HeadRotationLogic();
			if (currentState == State.Stunned && startOfStateClient)
			{
				anim.animator.SetTrigger("stun_trigger");
			}
			if (currentState == State.CreepyStare && startOfStateClient)
			{
				anim.CrackSound();
			}
			if (anim.breaker)
			{
				breakerPlayTimer += Time.deltaTime;
				if (breakerPlayTimer > breakerPlayTime)
				{
					anim.breaker = false;
					breakerPlayTimer = 0f;
				}
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			ColliderSizeLogic();
			if (enemy.IsStunned() && currentState != State.Stunned && currentState != State.Despawn)
			{
				replaceOldBalloons = false;
				if (currentState == State.PlaceBalloon)
				{
					InterruptBalloonPop();
					hasPendingBalloon = false;
				}
				UpdateState(State.Stunned);
			}
			if (PlayerTargetState() && (!Object.op_Implicit((Object)(object)playerTarget) || playerTarget.isDisabled))
			{
				UpdateState(State.Idle);
			}
			else if ((int)enemy.CurrentState == 11)
			{
				UpdateState(State.Despawn);
			}
			if (((Component)enemy.Rigidbody).transform.position.y - moveBackPosition.y < -2.5f && !enemy.IsStunned() && currentState != State.Despawn && !FlyState())
			{
				float num = float.PositiveInfinity;
				RaycastHit val = default(RaycastHit);
				if (Physics.Raycast(((Component)enemy.Rigidbody).transform.position, Vector3.down, ref val, 5f, LayerMask.GetMask(new string[1] { "Default" })))
				{
					num = Vector3.Distance(((Component)enemy.Rigidbody).transform.position, ((RaycastHit)(ref val)).point);
				}
				if (num > 2f)
				{
					UpdateState(State.FlyBackUp);
				}
			}
			CheckForCreepyStareStart();
			if (NavMeshState() && !enemy.Jump.jumping)
			{
				UpdateMoveBackPosition();
			}
			CheckForPoppedBalloons();
			if (!FlyState())
			{
				RotationLogic();
			}
			switch (currentState)
			{
			case State.Spawn:
				StateSpawn();
				break;
			case State.Despawn:
				StateDespawn();
				break;
			case State.Idle:
				StateIdle();
				break;
			case State.GoToBalloonPlacement:
				StateGoToBalloonPlacement();
				break;
			case State.PlaceBalloon:
				StatePlaceBalloon();
				break;
			case State.LeaveAfterBalloon:
				StateLeaveAfterBalloon();
				break;
			case State.Leave:
				StateLeave();
				break;
			case State.PlayerNotice:
				StatePlayerNotice();
				break;
			case State.GoToPlayerAngry:
				StateGoToPlayerAngry();
				break;
			case State.GoToBalloonAngry:
				StateGoToBalloonAngry();
				break;
			case State.SeekPlayer:
				StateSeekPlayer();
				break;
			case State.Investigate:
				StateInvestigate();
				break;
			case State.Attack:
				StateAttack();
				break;
			case State.AttackUnderStart:
				StateAttackUnderStart();
				break;
			case State.AttackUnder:
				StateAttackUnder();
				break;
			case State.AttackUnderEnd:
				StateAttackUnderEnd();
				break;
			case State.AttackOver:
				StateAttackOver();
				break;
			case State.StandUp:
				StateStandUp();
				break;
			case State.CreepyStare:
				StateCreepyStare();
				break;
			case State.LookAround:
				StateLookAround();
				break;
			case State.Stunned:
				StateStunned();
				break;
			case State.FlyBackUp:
				StateFlyBackUp();
				break;
			case State.FlyBackToNavMesh:
				StateFlyBackToNavMesh();
				break;
			}
		}

		private void PlayIdleBreaker(int index)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("PlayIdleBreakerRPC", (RpcTarget)0, new object[1] { index });
				}
				else
				{
					PlayIdleBreakerRPC(index);
				}
			}
		}

		[PunRPC]
		private void PlayIdleBreakerRPC(int index, PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: 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)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				anim.breaker = true;
				AudioClip val = anim.idleBreakers[index];
				AudioClip[] sounds = (AudioClip[])(object)new AudioClip[1] { val };
				anim.idleBreaker.Sounds = sounds;
				anim.idleBreaker.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			}
		}

		private void InterruptBalloonPop()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				anim.InterruptBalloonPop();
				if (GameManager.Multiplayer())
				{
					photonView.RPC("InterruptBalloonPopRPC", (RpcTarget)1, Array.Empty<object>());
				}
			}
		}

		[PunRPC]
		private void InterruptBalloonPopRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				anim.InterruptBalloonPop();
			}
		}

		public void UpdateState(State _nextState)
		{
			if (SemiFunc.IsMasterClientOrSingleplayer() && _nextState != currentState)
			{
				SemiLogger.LogMonika((object)("Change state to : " + _nextState), (GameObject)null, (Color?)null, true);
				onScreenTimer = 0f;
				stateImpulse = true;
				currentState = _nextState;
				if (GameManager.Multiplayer())
				{
					photonView.RPC("UpdateStateRPC", (RpcTarget)1, new object[1] { _nextState });
				}
			}
		}

		[PunRPC]
		private void UpdateStateRPC(State _nextState, PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				currentState = _nextState;
			}
		}

		private void BalloonPopEffect(Vector3 _pos, bool _global = true)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_008a: 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)
			GameObject val = Object.Instantiate<GameObject>(balloonPopEffect, _pos, Quaternion.identity);
			val.GetComponent<BirthdayBoyBalloonPopParticle>().ChangeParticleColor(balloonColor);
			val.GetComponent<BirthdayBoyBalloonPopParticle>().PlayParticle();
			anim.balloonPopSound.Play(_pos, 1f, 1f, 1f, 1f);
			if (_global)
			{
				anim.balloonPopGlobal.Play(_pos, 1f, 1f, 1f, 1f);
			}
			particleScriptExplosion.Spawn(_pos, 0.75f, 25, 10, 1f, false, false, 1f);
		}

		private void RemoveBalloon(Vector3 _position, bool _manualRemove = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0082: 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)
			float num = CheckIfPlayersNearbyPop(_position);
			if (!_manualRemove && num > popAggroRadius)
			{
				return;
			}
			bool poppedWhileDespawned = balloons[_position].GetComponentInChildren<BirthdayBoyBalloon>().poppedWhileDespawned;
			if (GameManager.Multiplayer())
			{
				photonView.RPC("RemoveBalloonRPC", (RpcTarget)0, new object[2]
				{
					_position,
					!_manualRemove
				});
			}
			else
			{
				RemoveBalloonRPC(_position, !_manualRemove);
			}
			if (!_manualRemove)
			{
				if (poppedWhileDespawned)
				{
					UpdateState(State.Spawn);
					angrySpawn = true;
				}
				else if (currentState != State.GoToPlayerAngry && currentState != State.Despawn && !AttackState() && num < popAggroRadius / 2f)
				{
					replaceOldBalloons = false;
					UpdateState(State.GoToBalloonAngry);
				}
			}
		}

		[PunRPC]
		private void RemoveBalloonRPC(Vector3 _position, bool _global, PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				BalloonPopEffect(_position, _global);
				Object.Destroy((Object)(object)balloons[_position]);
				balloons.Remove(_position);
				if (_global)
				{
					EnemyDirector.instance.SetInvestigate(_position, 5f, false);
				}
			}
		}

		private void SpawnBalloon(Vector3 _position)
		{
			//IL_0073: 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_007b: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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)
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				float num = Random.Range(0.5f, 1.5f);
				if (GameManager.Multiplayer())
				{
					photonView.RPC("SpawnBalloonRPC", (RpcTarget)0, new object[4] { _position, bPos, bScale, num });
				}
				else
				{
					SpawnBalloonRPC(_position, bPos, bScale, num);
				}
				balloons[_position].GetComponentInChildren<BirthdayBoyBalloon>().balloonIndex = balloonsPlacedTotal;
			}
		}

		[PunRPC]
		private void SpawnBalloonRPC(Vector3 _keyPos, Vector3 _spawnPos, Vector3 _spawnScale, float _randomSpeed, PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_009e: 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)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				balloons[_keyPos] = Object.Instantiate<GameObject>(balloonPrefab, _keyPos, Quaternion.identity);
				BirthdayBoyBalloon componentInChildren = balloons[_keyPos].GetComponentInChildren<BirthdayBoyBalloon>();
				componentInChildren.enemyParent = enemy.EnemyParent;
				componentInChildren.placerIndex = myIndex;
				componentInChildren.randomSpeed = _randomSpeed;
				if (myIndex != 0 && myIndex < 8)
				{
					componentInChildren.ChangeColor(balloonColor);
				}
				balloons[_keyPos].GetComponentInChildren<BirthdayBoyBalloon>().TakeToSpawnPoint(_spawnPos, _spawnScale);
			}
		}

		private void SyncBalloonPlacements()
		{
			//IL_004d: 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)
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				List<int> nonCollidingBalloonSpawnPoints = GetNonCollidingBalloonSpawnPoints();
				int[] array = GetBalloonSpawnPointIndexes(nonCollidingBalloonSpawnPoints).ToArray();
				if (GameManager.Multiplayer())
				{
					photonView.RPC("SyncBalloonPlacementsRPC", (RpcTarget)0, new object[1] { array });
				}
				else
				{
					SyncBalloonPlacementsRPC(array);
				}
			}
		}

		[PunRPC]
		private void SyncBalloonPlacementsRPC(int[] _spawnPoints, PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				List<int> list = new List<int>(_spawnPoints);
				balloonPlacements = list;
			}
		}

		private void BlowBalloonAnimation()
		{
			//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 (GameManager.Multiplayer())
			{
				photonView.RPC("BlowBalloonAnimationRPC", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				BlowBalloonAnimationRPC();
			}
		}

		[PunRPC]
		private void BlowBalloonAnimationRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				anim.BlowBalloonAnimationTrigger();
			}
		}

		private void UpdatePlayerTarget(PlayerAvatar _target)
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if (SemiFunc.IsMultiplayer() && (Object)(object)_target != (Object)null && (Object)(object)_target != (Object)(object)playerTarget)
				{
					photonView.RPC("UpdatePlayerTargetRPC", (RpcTarget)1, new object[1] { _target.photonView.ViewID });
				}
				playerTarget = _target;
			}
		}

		[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))
			{
				playerTarget = SemiFunc.PlayerAvatarGetFromPhotonID(photonViewID);
			}
		}

		private void UpdateLookTarget(PlayerAvatar _target)
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if (!SemiFunc.IsMultiplayer())
				{
					anim.lookTarget = _target;
				}
				else if (!Object.op_Implicit((Object)(object)anim.lookTarget) || anim.lookTarget.photonView.ViewID != _target.photonView.ViewID)
				{
					anim.lookTarget = _target;
					photonView.RPC("UpdateLookTargetRPC", (RpcTarget)1, new object[1] { _target.photonView.ViewID });
				}
			}
		}

		[PunRPC]
		private void UpdateLookTargetRPC(int photonViewID, PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				anim.lookTarget = SemiFunc.PlayerAvatarGetFromPhotonID(photonViewID);
			}
		}

		private void PopAllBalloons()
		{
			//IL_0033: 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)
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if (GameManager.Multiplayer())
				{
					photonView.RPC("PopAllBalloonsRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					PopAllBalloonsRPC();
				}
			}
		}

		[PunRPC]
		private void PopAllBalloonsRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.MasterOnlyRPC(_info))
			{
				return;
			}
			foreach (Vector3 item in new List<Vector3>(balloons.Keys))
			{
				BalloonPopEffect(item, _global: false);
				Object.Destroy((Object)(object)balloons[item]);
				balloons.Remove(item);
			}
		}

		[PunRPC]
		private void ToggleShrinkColliderRPC(bool _active, PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				((Component)BBcollider).gameObject.SetActive(!_active);
				((Component)colliderSmall).gameObject.SetActive(_active);
			}
		}

		private void StateSpawn()
		{
			if (stateImpulse)
			{
				stateImpulse = false;
				stateTimer = 1f;
			}
			stateTimer -= Time.deltaTime;
			if (stateTimer <= 0f)
			{
				if (angrySpawn)
				{
					angrySpawn = false;
					UpdateState(State.GoToBalloonAngry);
				}
				else
				{
					UpdateState(State.Idle);
				}
			}
		}

		private void StateDespawn()
		{
			if (stateImpulse)
			{
				stateImpulse = false;
				ResetNavMesh();
			}
		}

		private void StateIdle()
		{
			if (stateImpulse && !SkipStateImpulse)
			{
				ResetNavMesh();
				stateTimer = Random.Range(4f, 8f);
				stateImpulse = false;
				if (Random.Range(0, 10) > 4)
				{
					int index = Random.Range(0, 3);
					PlayIdleBreaker(index);
				}
			}
			SkipStateImpulse = false;
			if (!SemiFunc.EnemySpawnIdlePause())
			{
				stateTimer -= Time.deltaTime;
				if (stateTimer <= 0f)
				{
					UpdateState(State.GoToBalloonPlacement);
				}
				if (SemiFunc.EnemyForceLeave(enemy))
				{
					UpdateState(State.Leave);
				}
			}
		}

		private void StateGoToBalloonPlacement()
		{
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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_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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if (stateImpulse)
			{
				LevelPoint val = SemiFunc.LevelPointGet(((Component)this).transform.position, 5f, 15f);
				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.insideUnitSphe