Decompiled source of MitosisDancers v1.0.1

MitosisDancers/MitosisDancers.dll

Decompiled a day ago
using System;
using System.Collections;
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 HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using MitosisDancers.Behaviours;
using MitosisDancers.Patches;
using TeamCherry.Localization;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MitosisDancers")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+da65e5d13368ef8e0973392484ea9460a7b83401")]
[assembly: AssemblyProduct("MitosisDancers")]
[assembly: AssemblyTitle("MitosisDancers")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace MitosisDancers
{
	public class DelegateAction<TArg> : FsmStateAction
	{
		public Action<TArg>? Method;

		public TArg? Arg;

		public override void Reset()
		{
			Method = null;
			((FsmStateAction)this).Reset();
		}

		public override void OnEnter()
		{
			if (Method != null && Arg != null)
			{
				Method(Arg);
			}
			if (!((object)Arg is Action action) || action != new Action(base.Finish))
			{
				((FsmStateAction)this).Finish();
			}
		}
	}
	public static class FsmUtil
	{
		[PublicAPI]
		public static PlayMakerFSM? GetFsmPreprocessed(this GameObject go, string fsmName)
		{
			PlayMakerFSM[] components = go.GetComponents<PlayMakerFSM>();
			foreach (PlayMakerFSM val in components)
			{
				if (val.FsmName == fsmName)
				{
					val.Preprocess();
					return val;
				}
			}
			return null;
		}

		private static TVal? GetItemFromArray<TVal>(TVal[] origArray, Func<TVal, bool> isItemCheck) where TVal : class
		{
			foreach (TVal val in origArray)
			{
				if (isItemCheck(val))
				{
					return val;
				}
			}
			return null;
		}

		private static TVal[] GetItemsFromArray<TVal>(TVal[] origArray, Func<TVal, bool> isItemCheck) where TVal : class
		{
			int num = 0;
			foreach (TVal arg in origArray)
			{
				if (isItemCheck(arg))
				{
					num++;
				}
			}
			if (num == origArray.Length)
			{
				return origArray;
			}
			if (num == 0)
			{
				return Array.Empty<TVal>();
			}
			TVal[] array = new TVal[num];
			int num2 = 0;
			foreach (TVal val in origArray)
			{
				if (isItemCheck(val))
				{
					array[num2] = val;
					num2++;
				}
			}
			return array;
		}

		[PublicAPI]
		public static FsmState? GetState(this PlayMakerFSM fsm, string stateName)
		{
			string stateName2 = stateName;
			return GetItemFromArray(fsm.FsmStates, (FsmState x) => x.Name == stateName2);
		}

		[PublicAPI]
		public static FsmState? GetState(this Fsm fsm, string stateName)
		{
			string stateName2 = stateName;
			return GetItemFromArray(fsm.States, (FsmState x) => x.Name == stateName2);
		}

		[PublicAPI]
		public static FsmTransition? GetTransition(this PlayMakerFSM fsm, string stateName, string eventName)
		{
			return fsm.GetState(stateName).GetTransition(eventName);
		}

		[PublicAPI]
		public static FsmTransition? GetTransition(this Fsm fsm, string stateName, string eventName)
		{
			return fsm.GetState(stateName).GetTransition(eventName);
		}

		[PublicAPI]
		public static FsmTransition? GetTransition(this FsmState state, string eventName)
		{
			string eventName2 = eventName;
			return GetItemFromArray(state.Transitions, (FsmTransition x) => x.EventName == eventName2);
		}

		[PublicAPI]
		public static FsmTransition? GetGlobalTransition(this PlayMakerFSM fsm, string globalEventName)
		{
			return fsm.Fsm.GetGlobalTransition(globalEventName);
		}

		[PublicAPI]
		public static FsmTransition? GetGlobalTransition(this Fsm fsm, string globalEventName)
		{
			string globalEventName2 = globalEventName;
			return GetItemFromArray(fsm.GlobalTransitions, (FsmTransition x) => x.EventName == globalEventName2);
		}

		[PublicAPI]
		public static TAction? GetAction<TAction>(this PlayMakerFSM fsm, string stateName, int index) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetAction<TAction>(index);
		}

		[PublicAPI]
		public static TAction? GetAction<TAction>(this Fsm fsm, string stateName, int index) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetAction<TAction>(index);
		}

		[PublicAPI]
		public static TAction? GetAction<TAction>(this FsmState state, int index) where TAction : FsmStateAction
		{
			FsmStateAction obj = state.Actions[index];
			return (TAction)(object)((obj is TAction) ? obj : null);
		}

		[PublicAPI]
		public static FsmStateAction? GetStateAction(this PlayMakerFSM fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).GetStateAction(index);
		}

		[PublicAPI]
		public static FsmStateAction? GetStateAction(this Fsm fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).GetStateAction(index);
		}

		[PublicAPI]
		public static FsmStateAction? GetStateAction(this FsmState state, int index)
		{
			return state.Actions[index];
		}

		[PublicAPI]
		public static TAction[] GetActionsOfType<TAction>(this PlayMakerFSM fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetActionsOfType<TAction>();
		}

		[PublicAPI]
		public static TAction[] GetActionsOfType<TAction>(this Fsm fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetActionsOfType<TAction>();
		}

		[PublicAPI]
		public static TAction[] GetActionsOfType<TAction>(this FsmState state) where TAction : FsmStateAction
		{
			return Array.ConvertAll(GetItemsFromArray(state.Actions, (FsmStateAction x) => x is TAction), (FsmStateAction x) => (TAction)(object)x);
		}

		[PublicAPI]
		public static TAction? GetFirstActionOfType<TAction>(this PlayMakerFSM fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetFirstActionOfType<TAction>();
		}

		[PublicAPI]
		public static TAction? GetFirstActionOfType<TAction>(this Fsm fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetFirstActionOfType<TAction>();
		}

		[PublicAPI]
		public static TAction? GetFirstActionOfType<TAction>(this FsmState state) where TAction : FsmStateAction
		{
			int num = -1;
			for (int i = 0; i < state.Actions.Length; i++)
			{
				if (state.Actions[i] is TAction)
				{
					num = i;
					break;
				}
			}
			if (num == -1)
			{
				return default(TAction);
			}
			return state.GetAction<TAction>(num);
		}

		[PublicAPI]
		public static TAction? GetLastActionOfType<TAction>(this PlayMakerFSM fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetLastActionOfType<TAction>();
		}

		[PublicAPI]
		public static TAction? GetLastActionOfType<TAction>(this Fsm fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetLastActionOfType<TAction>();
		}

		[PublicAPI]
		public static TAction? GetLastActionOfType<TAction>(this FsmState state) where TAction : FsmStateAction
		{
			int num = -1;
			for (int num2 = state.Actions.Length - 1; num2 >= 0; num2--)
			{
				if (state.Actions[num2] is TAction)
				{
					num = num2;
					break;
				}
			}
			if (num == -1)
			{
				return default(TAction);
			}
			return state.GetAction<TAction>(num);
		}

		private static TVal[] AddItemToArray<TVal>(TVal[] origArray, TVal value)
		{
			TVal[] array = new TVal[origArray.Length + 1];
			origArray.CopyTo(array, 0);
			array[origArray.Length] = value;
			return array;
		}

		[PublicAPI]
		public static FsmState AddState(this PlayMakerFSM fsm, string stateName)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			return fsm.Fsm.AddState(new FsmState(fsm.Fsm)
			{
				Name = stateName
			});
		}

		[PublicAPI]
		public static FsmState AddState(this Fsm fsm, string stateName)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			return fsm.AddState(new FsmState(fsm)
			{
				Name = stateName
			});
		}

		[PublicAPI]
		public static FsmState AddState(this PlayMakerFSM fsm, FsmState state)
		{
			return fsm.Fsm.AddState(state);
		}

		[PublicAPI]
		public static FsmState AddState(this Fsm fsm, FsmState state)
		{
			FsmState[] states = fsm.States;
			FsmState[] array2 = (fsm.States = AddItemToArray(states, state));
			fsm.SaveActions();
			return array2[states.Length];
		}

		[PublicAPI]
		public static FsmState CopyState(this PlayMakerFSM fsm, string fromState, string toState)
		{
			return fsm.Fsm.CopyState(fromState, toState);
		}

		[PublicAPI]
		public static FsmState CopyState(this Fsm fsm, string fromState, string toState)
		{
			//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_0024: Expected O, but got Unknown
			FsmState state = fsm.GetState(fromState);
			if (state != null)
			{
				state.SaveActions();
			}
			FsmState val = new FsmState(state)
			{
				Name = toState
			};
			FsmTransition[] transitions = val.Transitions;
			foreach (FsmTransition val2 in transitions)
			{
				val2.ToFsmState = fsm.GetState(val2.ToState);
			}
			fsm.AddState(val);
			return val;
		}

		[PublicAPI]
		public static FsmEvent AddTransition(this PlayMakerFSM fsm, string stateName, string eventName, string toState)
		{
			return fsm.GetState(stateName).AddTransition(eventName, toState);
		}

		[PublicAPI]
		public static FsmEvent AddTransition(this Fsm fsm, string stateName, string eventName, string toState)
		{
			return fsm.GetState(stateName).AddTransition(eventName, toState);
		}

		[PublicAPI]
		public static FsmEvent AddTransition(this FsmState state, string eventName, string toState)
		{
			//IL_000e: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			FsmEvent fsmEvent = FsmEvent.GetFsmEvent(eventName);
			FsmTransition[] transitions = AddItemToArray(state.Transitions, new FsmTransition
			{
				ToState = toState,
				ToFsmState = state.Fsm.GetState(toState),
				FsmEvent = fsmEvent
			});
			state.Transitions = transitions;
			return fsmEvent;
		}

		[PublicAPI]
		public static FsmEvent AddGlobalTransition(this PlayMakerFSM fsm, string globalEventName, string toState)
		{
			return fsm.Fsm.AddGlobalTransition(globalEventName, toState);
		}

		[PublicAPI]
		public static FsmEvent AddGlobalTransition(this Fsm fsm, string globalEventName, string toState)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//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_0023: 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_003e: Expected O, but got Unknown
			FsmEvent val = new FsmEvent(globalEventName)
			{
				IsGlobal = true
			};
			FsmTransition[] globalTransitions = AddItemToArray(fsm.GlobalTransitions, new FsmTransition
			{
				ToState = toState,
				ToFsmState = fsm.GetState(toState),
				FsmEvent = val
			});
			fsm.GlobalTransitions = globalTransitions;
			return val;
		}

		[PublicAPI]
		public static void AddAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action)
		{
			fsm.GetState(stateName).AddAction(action);
		}

		[PublicAPI]
		public static void AddAction(this Fsm fsm, string stateName, FsmStateAction action)
		{
			fsm.GetState(stateName).AddAction(action);
		}

		[PublicAPI]
		public static void AddAction(this FsmState state, FsmStateAction action)
		{
			FsmStateAction[] actions = AddItemToArray(state.Actions, action);
			state.Actions = actions;
			action.Init(state);
		}

		[PublicAPI]
		public static void AddActions(this PlayMakerFSM fsm, string stateName, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).AddActions(actions);
		}

		[PublicAPI]
		public static void AddActions(this Fsm fsm, string stateName, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).AddActions(actions);
		}

		[PublicAPI]
		public static void AddActions(this FsmState state, params FsmStateAction[] actions)
		{
			foreach (FsmStateAction action in actions)
			{
				state.AddAction(action);
			}
		}

		[PublicAPI]
		public static void AddMethod(this PlayMakerFSM fsm, string stateName, Action<FsmStateAction> method)
		{
			fsm.GetState(stateName).AddMethod(method);
		}

		[PublicAPI]
		public static void AddMethod(this Fsm fsm, string stateName, Action<FsmStateAction> method)
		{
			fsm.GetState(stateName).AddMethod(method);
		}

		[PublicAPI]
		public static void AddMethod(this FsmState state, Action<FsmStateAction> method)
		{
			DelegateAction<FsmStateAction> delegateAction = new DelegateAction<FsmStateAction>
			{
				Method = method
			};
			delegateAction.Arg = (FsmStateAction?)(object)delegateAction;
			state.AddAction((FsmStateAction)(object)delegateAction);
		}

		[PublicAPI]
		public static void AddLambdaMethod(this PlayMakerFSM fsm, string stateName, Action<Action> method)
		{
			fsm.GetState(stateName).AddLambdaMethod(method);
		}

		[PublicAPI]
		public static void AddLambdaMethod(this Fsm fsm, string stateName, Action<Action> method)
		{
			fsm.GetState(stateName).AddLambdaMethod(method);
		}

		[PublicAPI]
		public static void AddLambdaMethod(this FsmState state, Action<Action> method)
		{
			DelegateAction<Action> delegateAction = new DelegateAction<Action>
			{
				Method = method
			};
			delegateAction.Arg = ((FsmStateAction)delegateAction).Finish;
			state.AddAction((FsmStateAction)(object)delegateAction);
		}

		private static TVal[] InsertItemIntoArray<TVal>(TVal[] origArray, TVal value, int index)
		{
			int num = origArray.Length;
			if (index < 0 || index > num + 1)
			{
				throw new ArgumentOutOfRangeException($"Index {index} was out of range for array with length {num}!");
			}
			TVal[] array = new TVal[num + 1];
			for (int i = 0; i < index; i++)
			{
				array[i] = origArray[i];
			}
			array[index] = value;
			for (int i = index; i < num; i++)
			{
				array[i + 1] = origArray[i];
			}
			return array;
		}

		[PublicAPI]
		public static void InsertAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action, int index)
		{
			fsm.GetState(stateName).InsertAction(index, action);
		}

		[PublicAPI]
		public static void InsertAction(this PlayMakerFSM fsm, string stateName, int index, FsmStateAction action)
		{
			fsm.GetState(stateName).InsertAction(index, action);
		}

		[PublicAPI]
		public static void InsertAction(this Fsm fsm, string stateName, FsmStateAction action, int index)
		{
			fsm.GetState(stateName).InsertAction(index, action);
		}

		[PublicAPI]
		public static void InsertAction(this Fsm fsm, string stateName, int index, FsmStateAction action)
		{
			fsm.GetState(stateName).InsertAction(index, action);
		}

		[PublicAPI]
		public static void InsertAction(this FsmState state, FsmStateAction action, int index)
		{
			state.InsertAction(index, action);
		}

		[PublicAPI]
		public static void InsertAction(this FsmState state, int index, FsmStateAction action)
		{
			FsmStateAction[] actions = InsertItemIntoArray(state.Actions, action, index);
			state.Actions = actions;
			action.Init(state);
		}

		[PublicAPI]
		public static void InsertActions(this PlayMakerFSM fsm, string stateName, int index, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).InsertActions(index, actions);
		}

		[PublicAPI]
		public static void InsertActions(this Fsm fsm, string stateName, int index, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).InsertActions(index, actions);
		}

		[PublicAPI]
		public static void InsertActions(this FsmState state, int index, params FsmStateAction[] actions)
		{
			foreach (FsmStateAction action in actions)
			{
				state.InsertAction(action, index);
				index++;
			}
		}

		[PublicAPI]
		public static void InsertMethod(this PlayMakerFSM fsm, string stateName, Action<FsmStateAction> method, int index)
		{
			fsm.GetState(stateName).InsertMethod(index, method);
		}

		[PublicAPI]
		public static void InsertMethod(this PlayMakerFSM fsm, string stateName, int index, Action<FsmStateAction> method)
		{
			fsm.GetState(stateName).InsertMethod(index, method);
		}

		[PublicAPI]
		public static void InsertMethod(this Fsm fsm, string stateName, Action<FsmStateAction> method, int index)
		{
			fsm.GetState(stateName).InsertMethod(index, method);
		}

		[PublicAPI]
		public static void InsertMethod(this Fsm fsm, string stateName, int index, Action<FsmStateAction> method)
		{
			fsm.GetState(stateName).InsertMethod(index, method);
		}

		[PublicAPI]
		public static void InsertMethod(this FsmState state, Action<FsmStateAction> method, int index)
		{
			state.InsertMethod(index, method);
		}

		[PublicAPI]
		public static void InsertMethod(this FsmState state, int index, Action<FsmStateAction> method)
		{
			DelegateAction<FsmStateAction> delegateAction = new DelegateAction<FsmStateAction>
			{
				Method = method
			};
			delegateAction.Arg = (FsmStateAction?)(object)delegateAction;
			state.InsertAction((FsmStateAction)(object)delegateAction, index);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this PlayMakerFSM fsm, string stateName, Action<Action> method, int index)
		{
			fsm.GetState(stateName).InsertLambdaMethod(index, method);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this PlayMakerFSM fsm, string stateName, int index, Action<Action> method)
		{
			fsm.GetState(stateName).InsertLambdaMethod(index, method);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this Fsm fsm, string stateName, Action<Action> method, int index)
		{
			fsm.GetState(stateName).InsertLambdaMethod(index, method);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this Fsm fsm, string stateName, int index, Action<Action> method)
		{
			fsm.GetState(stateName).InsertLambdaMethod(index, method);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this FsmState state, Action<Action> method, int index)
		{
			state.InsertLambdaMethod(index, method);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this FsmState state, int index, Action<Action> method)
		{
			DelegateAction<Action> delegateAction = new DelegateAction<Action>
			{
				Method = method
			};
			delegateAction.Arg = ((FsmStateAction)delegateAction).Finish;
			state.InsertAction((FsmStateAction)(object)delegateAction, index);
		}

		[PublicAPI]
		public static void ReplaceAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action, int index)
		{
			fsm.GetState(stateName).ReplaceAction(index, action);
		}

		[PublicAPI]
		public static void ReplaceAction(this PlayMakerFSM fsm, string stateName, int index, FsmStateAction action)
		{
			fsm.GetState(stateName).ReplaceAction(index, action);
		}

		[PublicAPI]
		public static void ReplaceAction(this Fsm fsm, string stateName, FsmStateAction action, int index)
		{
			fsm.GetState(stateName).ReplaceAction(index, action);
		}

		[PublicAPI]
		public static void ReplaceAction(this Fsm fsm, string stateName, int index, FsmStateAction action)
		{
			fsm.GetState(stateName).ReplaceAction(index, action);
		}

		[PublicAPI]
		public static void ReplaceAction(this FsmState state, FsmStateAction action, int index)
		{
			state.ReplaceAction(index, action);
		}

		[PublicAPI]
		public static void ReplaceAction(this FsmState state, int index, FsmStateAction action)
		{
			state.Actions[index] = action;
			action.Init(state);
		}

		[PublicAPI]
		public static void ReplaceAllActions(this PlayMakerFSM fsm, string stateName, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).ReplaceAllActions(actions);
		}

		[PublicAPI]
		public static void ReplaceAllActions(this Fsm fsm, string stateName, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).ReplaceAllActions(actions);
		}

		[PublicAPI]
		public static void ReplaceAllActions(this FsmState state, params FsmStateAction[] actions)
		{
			state.Actions = actions;
			foreach (FsmStateAction val in actions)
			{
				val.Init(state);
			}
		}

		[PublicAPI]
		public static bool ChangeTransition(this PlayMakerFSM fsm, string stateName, string eventName, string toState)
		{
			return fsm.GetState(stateName).ChangeTransition(eventName, toState);
		}

		[PublicAPI]
		public static bool ChangeTransition(this Fsm fsm, string stateName, string eventName, string toState)
		{
			return fsm.GetState(stateName).ChangeTransition(eventName, toState);
		}

		[PublicAPI]
		public static bool ChangeTransition(this FsmState state, string eventName, string toState)
		{
			FsmTransition transition = state.GetTransition(eventName);
			if (transition == null)
			{
				return false;
			}
			transition.ToState = toState;
			transition.ToFsmState = state.Fsm.GetState(toState);
			return true;
		}

		[PublicAPI]
		public static bool ChangeGlobalTransition(this PlayMakerFSM fsm, string globalEventName, string toState)
		{
			return fsm.Fsm.ChangeGlobalTransition(globalEventName, toState);
		}

		[PublicAPI]
		public static bool ChangeGlobalTransition(this Fsm fsm, string globalEventName, string toState)
		{
			FsmTransition globalTransition = fsm.GetGlobalTransition(globalEventName);
			if (globalTransition == null)
			{
				return false;
			}
			globalTransition.ToState = toState;
			globalTransition.ToFsmState = fsm.GetState(toState);
			return true;
		}

		private static TVal[] RemoveItemsFromArray<TVal>(TVal[] origArray, Func<TVal, bool> shouldBeRemovedCallback)
		{
			int num = 0;
			foreach (TVal arg in origArray)
			{
				if (shouldBeRemovedCallback(arg))
				{
					num++;
				}
			}
			if (num == 0)
			{
				return origArray;
			}
			TVal[] array = new TVal[origArray.Length - num];
			for (int num2 = origArray.Length - 1; num2 >= 0; num2--)
			{
				TVal val = origArray[num2];
				if (shouldBeRemovedCallback(val))
				{
					num--;
				}
				else
				{
					array[num2 - num] = val;
				}
			}
			return array;
		}

		[PublicAPI]
		public static void RemoveState(this PlayMakerFSM fsm, string stateName)
		{
			fsm.Fsm.RemoveState(stateName);
		}

		[PublicAPI]
		public static void RemoveState(this Fsm fsm, string stateName)
		{
			string stateName2 = stateName;
			fsm.States = RemoveItemsFromArray(fsm.States, (FsmState x) => x.Name == stateName2);
		}

		[PublicAPI]
		public static void RemoveTransition(this PlayMakerFSM fsm, string stateName, string eventName)
		{
			fsm.GetState(stateName).RemoveTransition(eventName);
		}

		[PublicAPI]
		public static void RemoveTransition(this Fsm fsm, string stateName, string eventName)
		{
			fsm.GetState(stateName).RemoveTransition(eventName);
		}

		[PublicAPI]
		public static void RemoveTransition(this FsmState state, string eventName)
		{
			string eventName2 = eventName;
			state.Transitions = RemoveItemsFromArray(state.Transitions, (FsmTransition x) => x.EventName == eventName2);
		}

		[PublicAPI]
		public static void RemoveGlobalTransition(this PlayMakerFSM fsm, string globalEventName)
		{
			fsm.Fsm.RemoveGlobalTransition(globalEventName);
		}

		[PublicAPI]
		public static void RemoveGlobalTransition(this Fsm fsm, string globalEventName)
		{
			string globalEventName2 = globalEventName;
			fsm.GlobalTransitions = RemoveItemsFromArray(fsm.GlobalTransitions, (FsmTransition x) => x.EventName == globalEventName2);
		}

		[PublicAPI]
		public static void RemoveTransitionsTo(this PlayMakerFSM fsm, string toState)
		{
			fsm.Fsm.RemoveTransitionsTo(toState);
		}

		[PublicAPI]
		public static void RemoveTransitionsTo(this Fsm fsm, string toState)
		{
			FsmState[] states = fsm.States;
			foreach (FsmState state in states)
			{
				state.RemoveTransitionsTo(toState);
			}
		}

		[PublicAPI]
		public static void RemoveTransitionsTo(this PlayMakerFSM fsm, string stateName, string toState)
		{
			fsm.GetState(stateName).RemoveTransitionsTo(toState);
		}

		[PublicAPI]
		public static void RemoveTransitionsTo(this Fsm fsm, string stateName, string toState)
		{
			fsm.GetState(stateName).RemoveTransitionsTo(toState);
		}

		[PublicAPI]
		public static void RemoveTransitionsTo(this FsmState state, string toState)
		{
			string toState2 = toState;
			state.Transitions = RemoveItemsFromArray(state.Transitions, (FsmTransition x) => x.ToState == toState2);
		}

		[PublicAPI]
		public static void RemoveTransitions(this PlayMakerFSM fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveTransitions();
		}

		[PublicAPI]
		public static void RemoveTransitions(this Fsm fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveTransitions();
		}

		[PublicAPI]
		public static void RemoveTransitions(this FsmState state)
		{
			state.Transitions = Array.Empty<FsmTransition>();
		}

		[PublicAPI]
		public static bool RemoveAction(this PlayMakerFSM fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).RemoveAction(index);
		}

		[PublicAPI]
		public static bool RemoveAction(this Fsm fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).RemoveAction(index);
		}

		[PublicAPI]
		public static bool RemoveAction(this FsmState state, int index)
		{
			FsmStateAction[] actions = state.Actions;
			if (index < 0 || index >= actions.Length)
			{
				return false;
			}
			FsmStateAction[] array = (FsmStateAction[])(object)new FsmStateAction[actions.Length - 1];
			int num = array.Length;
			for (int i = 0; i < index; i++)
			{
				array[i] = actions[i];
			}
			for (int i = index; i < num; i++)
			{
				array[i] = actions[i + 1];
			}
			state.Actions = array;
			return true;
		}

		[PublicAPI]
		public static void RemoveActionsOfType<TAction>(this PlayMakerFSM fsm)
		{
			fsm.Fsm.RemoveActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveActionsOfType<TAction>(this Fsm fsm)
		{
			FsmState[] states = fsm.States;
			foreach (FsmState state in states)
			{
				state.RemoveActionsOfType<TAction>();
			}
		}

		[PublicAPI]
		public static void RemoveActionsOfType<TAction>(this PlayMakerFSM fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveActionsOfType<TAction>(this Fsm fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveActionsOfType<TAction>(this FsmState state)
		{
			state.Actions = RemoveItemsFromArray(state.Actions, (FsmStateAction x) => x is TAction);
		}

		[PublicAPI]
		public static void RemoveFirstActionOfType<TAction>(this PlayMakerFSM fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveFirstActionOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveFirstActionOfType<TAction>(this Fsm fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveFirstActionOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveFirstActionOfType<TAction>(this FsmState state)
		{
			int num = -1;
			for (int i = 0; i < state.Actions.Length; i++)
			{
				if (state.Actions[i] is TAction)
				{
					num = i;
					break;
				}
			}
			if (num != -1)
			{
				state.RemoveAction(num);
			}
		}

		[PublicAPI]
		public static void RemoveLastActionOfType<TAction>(this PlayMakerFSM fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveLastActionOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveLastActionOfType<TAction>(this Fsm fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveLastActionOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveLastActionOfType<TAction>(this FsmState state)
		{
			int num = -1;
			for (int num2 = state.Actions.Length - 1; num2 >= 0; num2--)
			{
				if (state.Actions[num2] is TAction)
				{
					num = num2;
					break;
				}
			}
			if (num != -1)
			{
				state.RemoveAction(num);
			}
		}

		[PublicAPI]
		public static bool DisableAction(this PlayMakerFSM fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).DisableAction(index);
		}

		[PublicAPI]
		public static bool DisableAction(this Fsm fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).DisableAction(index);
		}

		[PublicAPI]
		public static bool DisableAction(this FsmState state, int index)
		{
			if (index < 0 || index >= state.Actions.Length)
			{
				return false;
			}
			state.Actions[index].Enabled = false;
			return true;
		}

		[PublicAPI]
		public static bool DisableActions(this PlayMakerFSM fsm, string stateName, params int[] indices)
		{
			return fsm.GetState(stateName).DisableActions(indices);
		}

		[PublicAPI]
		public static bool DisableActions(this Fsm fsm, string stateName, params int[] indices)
		{
			return fsm.GetState(stateName).DisableActions(indices);
		}

		[PublicAPI]
		public static bool DisableActions(this FsmState state, params int[] indices)
		{
			bool flag = true;
			foreach (int index in indices)
			{
				flag = flag && state.DisableAction(index);
			}
			return flag;
		}

		[PublicAPI]
		public static void DisableActionsOfType<TAction>(this PlayMakerFSM fsm)
		{
			fsm.Fsm.DisableActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void DisableActionsOfType<TAction>(this Fsm fsm)
		{
			FsmState[] states = fsm.States;
			foreach (FsmState state in states)
			{
				state.DisableActionsOfType<TAction>();
			}
		}

		[PublicAPI]
		public static void DisableActionsOfType<TAction>(this PlayMakerFSM fsm, string stateName)
		{
			fsm.GetState(stateName).DisableActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void DisableActionsOfType<TAction>(this Fsm fsm, string stateName)
		{
			fsm.GetState(stateName).DisableActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void DisableActionsOfType<TAction>(this FsmState state)
		{
			FsmStateAction[] actions = state.Actions;
			foreach (FsmStateAction val in actions)
			{
				if (val is TAction)
				{
					val.Enabled = false;
				}
			}
		}

		private static TVar[] MakeNewVariableArray<TVar>(TVar[] orig, string name) where TVar : NamedVariable, new()
		{
			TVar[] array = new TVar[orig.Length + 1];
			orig.CopyTo(array, 0);
			int num = orig.Length;
			TVar val = new TVar();
			((NamedVariable)val).name = name;
			array[num] = val;
			return array;
		}

		[PublicAPI]
		public static FsmFloat AddFloatVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddFloatVariable(name);
		}

		[PublicAPI]
		public static FsmFloat AddFloatVariable(this Fsm fsm, string name)
		{
			FsmFloat[] array = MakeNewVariableArray<FsmFloat>(fsm.Variables.FloatVariables, name);
			fsm.Variables.FloatVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmInt AddIntVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddIntVariable(name);
		}

		[PublicAPI]
		public static FsmInt AddIntVariable(this Fsm fsm, string name)
		{
			FsmInt[] array = MakeNewVariableArray<FsmInt>(fsm.Variables.IntVariables, name);
			fsm.Variables.IntVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmBool AddBoolVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddBoolVariable(name);
		}

		[PublicAPI]
		public static FsmBool AddBoolVariable(this Fsm fsm, string name)
		{
			FsmBool[] array = MakeNewVariableArray<FsmBool>(fsm.Variables.BoolVariables, name);
			fsm.Variables.BoolVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmString AddStringVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddStringVariable(name);
		}

		[PublicAPI]
		public static FsmString AddStringVariable(this Fsm fsm, string name)
		{
			FsmString[] array = MakeNewVariableArray<FsmString>(fsm.Variables.StringVariables, name);
			fsm.Variables.StringVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmVector2 AddVector2Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddVector2Variable(name);
		}

		[PublicAPI]
		public static FsmVector2 AddVector2Variable(this Fsm fsm, string name)
		{
			FsmVector2[] array = MakeNewVariableArray<FsmVector2>(fsm.Variables.Vector2Variables, name);
			fsm.Variables.Vector2Variables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmVector3 AddVector3Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddVector3Variable(name);
		}

		[PublicAPI]
		public static FsmVector3 AddVector3Variable(this Fsm fsm, string name)
		{
			FsmVector3[] array = MakeNewVariableArray<FsmVector3>(fsm.Variables.Vector3Variables, name);
			fsm.Variables.Vector3Variables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmColor AddColorVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddColorVariable(name);
		}

		[PublicAPI]
		public static FsmColor AddColorVariable(this Fsm fsm, string name)
		{
			FsmColor[] array = MakeNewVariableArray<FsmColor>(fsm.Variables.ColorVariables, name);
			fsm.Variables.ColorVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmRect AddRectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddRectVariable(name);
		}

		[PublicAPI]
		public static FsmRect AddRectVariable(this Fsm fsm, string name)
		{
			FsmRect[] array = MakeNewVariableArray<FsmRect>(fsm.Variables.RectVariables, name);
			fsm.Variables.RectVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmQuaternion AddQuaternionVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddQuaternionVariable(name);
		}

		[PublicAPI]
		public static FsmQuaternion AddQuaternionVariable(this Fsm fsm, string name)
		{
			FsmQuaternion[] array = MakeNewVariableArray<FsmQuaternion>(fsm.Variables.QuaternionVariables, name);
			fsm.Variables.QuaternionVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmGameObject AddGameObjectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddGameObjectVariable(name);
		}

		[PublicAPI]
		public static FsmGameObject AddGameObjectVariable(this Fsm fsm, string name)
		{
			FsmGameObject[] array = MakeNewVariableArray<FsmGameObject>(fsm.Variables.GameObjectVariables, name);
			fsm.Variables.GameObjectVariables = array;
			return array[^1];
		}

		private static TVar? FindInVariableArray<TVar>(TVar[] orig, string name) where TVar : NamedVariable, new()
		{
			foreach (TVar val in orig)
			{
				if (((NamedVariable)val).Name == name)
				{
					return val;
				}
			}
			return default(TVar);
		}

		[PublicAPI]
		public static FsmFloat? FindFloatVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindFloatVariable(name);
		}

		[PublicAPI]
		public static FsmFloat? FindFloatVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmFloat>(fsm.Variables.FloatVariables, name);
		}

		[PublicAPI]
		public static FsmInt? FindIntVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindIntVariable(name);
		}

		[PublicAPI]
		public static FsmInt? FindIntVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmInt>(fsm.Variables.IntVariables, name);
		}

		[PublicAPI]
		public static FsmBool? FindBoolVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindBoolVariable(name);
		}

		[PublicAPI]
		public static FsmBool? FindBoolVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmBool>(fsm.Variables.BoolVariables, name);
		}

		[PublicAPI]
		public static FsmString? FindStringVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindStringVariable(name);
		}

		[PublicAPI]
		public static FsmString? FindStringVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmString>(fsm.Variables.StringVariables, name);
		}

		[PublicAPI]
		public static FsmVector2? FindVector2Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindVector2Variable(name);
		}

		[PublicAPI]
		public static FsmVector2? FindVector2Variable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmVector2>(fsm.Variables.Vector2Variables, name);
		}

		[PublicAPI]
		public static FsmVector3? FindVector3Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindVector3Variable(name);
		}

		[PublicAPI]
		public static FsmVector3? FindVector3Variable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmVector3>(fsm.Variables.Vector3Variables, name);
		}

		[PublicAPI]
		public static FsmColor? FindColorVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindColorVariable(name);
		}

		[PublicAPI]
		public static FsmColor? FindColorVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmColor>(fsm.Variables.ColorVariables, name);
		}

		[PublicAPI]
		public static FsmRect? FindRectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindRectVariable(name);
		}

		[PublicAPI]
		public static FsmRect? FindRectVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmRect>(fsm.Variables.RectVariables, name);
		}

		[PublicAPI]
		public static FsmQuaternion? FindQuaternionVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindQuaternionVariable(name);
		}

		[PublicAPI]
		public static FsmQuaternion? FindQuaternionVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmQuaternion>(fsm.Variables.QuaternionVariables, name);
		}

		[PublicAPI]
		public static FsmGameObject? FindGameObjectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindGameObjectVariable(name);
		}

		[PublicAPI]
		public static FsmGameObject? FindGameObjectVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmGameObject>(fsm.Variables.GameObjectVariables, name);
		}

		[PublicAPI]
		public static FsmFloat GetFloatVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetFloatVariable(name);
		}

		[PublicAPI]
		public static FsmFloat GetFloatVariable(this Fsm fsm, string name)
		{
			FsmFloat val = fsm.FindFloatVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddFloatVariable(name);
		}

		[PublicAPI]
		public static FsmInt GetIntVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetIntVariable(name);
		}

		[PublicAPI]
		public static FsmInt GetIntVariable(this Fsm fsm, string name)
		{
			FsmInt val = fsm.FindIntVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddIntVariable(name);
		}

		[PublicAPI]
		public static FsmBool GetBoolVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetBoolVariable(name);
		}

		[PublicAPI]
		public static FsmBool GetBoolVariable(this Fsm fsm, string name)
		{
			FsmBool val = fsm.FindBoolVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddBoolVariable(name);
		}

		[PublicAPI]
		public static FsmString GetStringVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetStringVariable(name);
		}

		[PublicAPI]
		public static FsmString GetStringVariable(this Fsm fsm, string name)
		{
			FsmString val = fsm.FindStringVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddStringVariable(name);
		}

		[PublicAPI]
		public static FsmVector2 GetVector2Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetVector2Variable(name);
		}

		[PublicAPI]
		public static FsmVector2 GetVector2Variable(this Fsm fsm, string name)
		{
			FsmVector2 val = fsm.FindVector2Variable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddVector2Variable(name);
		}

		[PublicAPI]
		public static FsmVector3 GetVector3Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetVector3Variable(name);
		}

		[PublicAPI]
		public static FsmVector3 GetVector3Variable(this Fsm fsm, string name)
		{
			FsmVector3 val = fsm.FindVector3Variable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddVector3Variable(name);
		}

		[PublicAPI]
		public static FsmColor GetColorVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetColorVariable(name);
		}

		[PublicAPI]
		public static FsmColor GetColorVariable(this Fsm fsm, string name)
		{
			FsmColor val = fsm.FindColorVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddColorVariable(name);
		}

		[PublicAPI]
		public static FsmRect GetRectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetRectVariable(name);
		}

		[PublicAPI]
		public static FsmRect GetRectVariable(this Fsm fsm, string name)
		{
			FsmRect val = fsm.FindRectVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddRectVariable(name);
		}

		[PublicAPI]
		public static FsmQuaternion GetQuaternionVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetQuaternionVariable(name);
		}

		[PublicAPI]
		public static FsmQuaternion GetQuaternionVariable(this Fsm fsm, string name)
		{
			FsmQuaternion val = fsm.FindQuaternionVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddQuaternionVariable(name);
		}

		[PublicAPI]
		public static FsmGameObject GetGameObjectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetGameObjectVariable(name);
		}

		[PublicAPI]
		public static FsmGameObject GetGameObjectVariable(this Fsm fsm, string name)
		{
			FsmGameObject val = fsm.FindGameObjectVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddGameObjectVariable(name);
		}
	}
	[BepInPlugin("MitosisDancers", "MitosisDancers", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static Harmony _harmony;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Debug.Log((object)"Plugin MitosisDancers (1.0.0) has loaded!");
			_harmony = new Harmony("1.0.0");
			MainPatches.Initialize();
			_harmony.PatchAll(typeof(MainPatches));
		}

		private void OnDestroy()
		{
			_harmony.UnpatchSelf();
		}
	}
}
namespace MitosisDancers.Patches
{
	internal static class BossPatches
	{
		internal static GameObject[] AllDancers = (GameObject[])(object)new GameObject[8];

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayMakerFSM), "Start")]
		private static void ModifyDancer(PlayMakerFSM __instance)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			string name = ((Object)((Component)__instance).gameObject).name;
			if (name == "Dancer Control" && __instance.FsmName == "Control" && (Object)(object)((Component)__instance).gameObject.GetComponent<MitosisDancersInit>() == (Object)null)
			{
				GameObject gameObject = ((Component)__instance).gameObject;
				AllDancers[0] = gameObject;
				((Component)__instance).gameObject.AddComponent<MitosisDancersInit>();
				for (int i = 1; i < 8; i++)
				{
					GameObject val = Object.Instantiate<GameObject>(gameObject, gameObject.transform.position, gameObject.transform.rotation);
					AllDancers[i] = val;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Language), "Get", new Type[]
		{
			typeof(string),
			typeof(string)
		})]
		private static void ChangeDancersTitle(string key, string sheetTitle, ref string __result)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			if (1 == 0)
			{
			}
			string text2;
			if (key == "COGWORK_DANCERS_SUPER")
			{
				LanguageCode val = Language.CurrentLanguage();
				if (1 == 0)
				{
				}
				string text = (((int)val == 44) ? "Mitosis" : (((int)val != 117) ? __result : "자가복제"));
				if (1 == 0)
				{
				}
				text2 = text;
			}
			else
			{
				text2 = __result;
			}
			if (1 == 0)
			{
			}
			__result = text2;
		}
	}
	internal static class HealthSharePatch
	{
		internal static int SharedHealth = 100;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HealthManager), "TakeDamage")]
		private static void DamageTaken(HealthManager __instance, HitInstance hitInstance)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((Component)((Component)__instance).transform.parent).gameObject.GetComponent<MitosisDancersInit>()))
			{
				Debug.Log((object)"doing shared Damage");
				SharedHealth -= hitInstance.DamageDealt;
				__instance.hp = SharedHealth;
			}
		}

		internal static void PhaseHPsetter(int health)
		{
			SharedHealth = health;
		}
	}
	internal static class MainPatches
	{
		[CompilerGenerated]
		private sealed class <Unpatch>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IEnumerator result;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Unpatch>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (result.MoveNext())
				{
					<>2__current = result.Current;
					<>1__state = 1;
					return true;
				}
				_harmony.UnpatchSelf();
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static Harmony _harmony;

		internal static void Initialize()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_harmony = new Harmony("MainPatches");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameManager), "SetLoadedGameData", new Type[]
		{
			typeof(SaveGameData),
			typeof(int)
		})]
		private static void CheckPatchDancers(GameManager __instance)
		{
			__instance.GetSaveStatsForSlot(PlayerData.instance.profileID, (Action<SaveStats, string>)delegate
			{
				_harmony.PatchAll(typeof(BossPatches));
				_harmony.PatchAll(typeof(HealthSharePatch));
			});
		}

		[IteratorStateMachine(typeof(<Unpatch>d__3))]
		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameManager), "ReturnToMainMenu")]
		private static IEnumerator Unpatch(IEnumerator result)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Unpatch>d__3(0)
			{
				result = result
			};
		}
	}
}
namespace MitosisDancers.Behaviours
{
	[RequireComponent(typeof(PlayMakerFSM))]
	internal class MitosisDancersInit : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass23_0
		{
			public MitosisDancersInit <>4__this;

			public GameObject ringholder;

			public GameObject[] tophalf;

			public GameObject[] groundhalf;

			internal void <OrderModifier>b__3(FsmStateAction _)
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: 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_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(0.75f, 0.75f, 0.75f);
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(0f, 0.8f, 0f);
				<>4__this.currentscale = val;
				<>4__this.dancerA.transform.localScale = val;
				<>4__this.dancerB.transform.localScale = val;
				ringholder.transform.localScale = val;
				GameObject[] array = tophalf;
				foreach (GameObject val3 in array)
				{
					Transform transform = val3.transform;
					transform.position += val2;
				}
				GameObject[] array2 = groundhalf;
				foreach (GameObject val4 in array2)
				{
					Transform transform2 = val4.transform;
					transform2.position -= val2;
				}
			}

			internal void <OrderModifier>b__4(FsmStateAction _)
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: 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_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(0.5f, 0.5f, 0.5f);
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(0f, 0.8f, 0f);
				<>4__this.currentscale = val;
				<>4__this.dancerA.transform.localScale = val;
				<>4__this.dancerB.transform.localScale = val;
				ringholder.transform.localScale = val;
				GameObject[] array = tophalf;
				foreach (GameObject val3 in array)
				{
					Transform transform = val3.transform;
					transform.position += val2;
				}
				GameObject[] array2 = groundhalf;
				foreach (GameObject val4 in array2)
				{
					Transform transform2 = val4.transform;
					transform2.position -= val2;
				}
			}

			internal void <OrderModifier>b__5(FsmStateAction _)
			{
				<>4__this.dancerA_control.SendEvent("DIE");
				<>4__this.dancerB_control.SendEvent("DIE");
				<>4__this._control.fsm.GetFsmInt("Dancers Killed").value = 2;
			}

			internal void <OrderModifier>b__9(FsmStateAction _)
			{
				<>4__this.dancerA.SetActive(true);
				<>4__this.dancerB.SetActive(true);
			}

			internal void <OrderModifier>b__10(FsmStateAction _)
			{
				<>4__this.dancerA.SetActive(true);
				<>4__this.dancerB.SetActive(true);
			}

			internal void <OrderModifier>b__11(FsmStateAction _)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				<>4__this.dancerA.transform.localScale = <>4__this.currentscale;
				<>4__this.dancerB.transform.localScale = <>4__this.currentscale;
			}
		}

		[CompilerGenerated]
		private sealed class <OrderModifier>d__23 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public MitosisDancersInit <>4__this;

			private <>c__DisplayClass23_0 <>8__1;

			private FsmState <delaystate>5__2;

			private GameObject <bladesphere>5__3;

			private GameObject <ring>5__4;

			private GameObject <ringglow>5__5;

			private FsmState <deathstate>5__6;

			private FsmState <emergeA>5__7;

			private FsmState <emergeB>5__8;

			private GameObject[] <>s__9;

			private int <>s__10;

			private GameObject <pos>5__11;

			private GameObject[] <>s__12;

			private int <>s__13;

			private GameObject <pos>5__14;

			private int <>s__15;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <OrderModifier>d__23(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<delaystate>5__2 = null;
				<bladesphere>5__3 = null;
				<ring>5__4 = null;
				<ringglow>5__5 = null;
				<deathstate>5__6 = null;
				<emergeA>5__7 = null;
				<emergeB>5__8 = null;
				<>s__9 = null;
				<pos>5__11 = null;
				<>s__12 = null;
				<pos>5__14 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Expected O, but got Unknown
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_0737: Unknown result type (might be due to invalid IL or missing references)
				//IL_0746: Unknown result type (might be due to invalid IL or missing references)
				//IL_074b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0767: Unknown result type (might be due to invalid IL or missing references)
				//IL_0776: Unknown result type (might be due to invalid IL or missing references)
				//IL_077b: Unknown result type (might be due to invalid IL or missing references)
				//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_07e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0802: Unknown result type (might be due to invalid IL or missing references)
				//IL_0811: Unknown result type (might be due to invalid IL or missing references)
				//IL_0816: Unknown result type (might be due to invalid IL or missing references)
				//IL_0905: Unknown result type (might be due to invalid IL or missing references)
				//IL_0914: Unknown result type (might be due to invalid IL or missing references)
				//IL_0919: Unknown result type (might be due to invalid IL or missing references)
				//IL_0935: Unknown result type (might be due to invalid IL or missing references)
				//IL_0944: Unknown result type (might be due to invalid IL or missing references)
				//IL_0949: Unknown result type (might be due to invalid IL or missing references)
				//IL_09fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a0c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a11: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a2d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a3c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a41: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a98: Unknown result type (might be due to invalid IL or missing references)
				//IL_0aa7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0aac: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ac8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ad7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0adc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b90: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b9f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ba4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bc0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bcf: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bd4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c2b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c3a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c3f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c5b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c6a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c6f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d23: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d32: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d37: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d53: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d62: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d67: Unknown result type (might be due to invalid IL or missing references)
				//IL_0dbe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0dcd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0dd2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0dee: Unknown result type (might be due to invalid IL or missing references)
				//IL_0dfd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0e02: Unknown result type (might be due to invalid IL or missing references)
				//IL_0eb6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ec5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0eca: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ee6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ef5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0efa: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f51: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f60: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f65: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f81: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f90: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f95: Unknown result type (might be due to invalid IL or missing references)
				//IL_1049: Unknown result type (might be due to invalid IL or missing references)
				//IL_1058: Unknown result type (might be due to invalid IL or missing references)
				//IL_105d: Unknown result type (might be due to invalid IL or missing references)
				//IL_1079: Unknown result type (might be due to invalid IL or missing references)
				//IL_1088: Unknown result type (might be due to invalid IL or missing references)
				//IL_108d: Unknown result type (might be due to invalid IL or missing references)
				//IL_10e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_10f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_10f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_1114: Unknown result type (might be due to invalid IL or missing references)
				//IL_1123: Unknown result type (might be due to invalid IL or missing references)
				//IL_1128: Unknown result type (might be due to invalid IL or missing references)
				//IL_11dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_11eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_11f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_120c: Unknown result type (might be due to invalid IL or missing references)
				//IL_121b: Unknown result type (might be due to invalid IL or missing references)
				//IL_1220: Unknown result type (might be due to invalid IL or missing references)
				//IL_1257: Unknown result type (might be due to invalid IL or missing references)
				//IL_125c: Unknown result type (might be due to invalid IL or missing references)
				//IL_128b: Unknown result type (might be due to invalid IL or missing references)
				//IL_1290: Unknown result type (might be due to invalid IL or missing references)
				//IL_12bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_12c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_12f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_12f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0654: Unknown result type (might be due to invalid IL or missing references)
				//IL_0668: Unknown result type (might be due to invalid IL or missing references)
				//IL_066d: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass23_0();
					<>8__1.<>4__this = <>4__this;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 2;
					return true;
				case 2:
				{
					<>1__state = -1;
					<delaystate>5__2 = <>4__this._beat.AddState("Order Delay");
					<delaystate>5__2.AddTransition("FINISHED", "Beat");
					<>4__this._beat.ChangeTransition("Init", "BEGIN", "Order Delay");
					<>8__1.ringholder = new GameObject("Ring Holder");
					<bladesphere>5__3 = <>4__this.dancerA_control.fsm.GetFsmGameObject("Blade Sphere").value;
					<ring>5__4 = ((Component)((Component)<>4__this).gameObject.transform.Find("Join Ring")).gameObject;
					<ringglow>5__5 = ((Component)((Component)<>4__this).gameObject.transform.Find("Join Glow")).gameObject;
					<>8__1.ringholder.transform.position = <ring>5__4.transform.position;
					<bladesphere>5__3.transform.parent = <>8__1.ringholder.transform;
					<ring>5__4.transform.parent = <>8__1.ringholder.transform;
					<ringglow>5__5.transform.parent = <>8__1.ringholder.transform;
					<>8__1.ringholder.transform.parent = ((Component)<>4__this).gameObject.transform;
					<>8__1.ringholder.transform.parent = ((Component)<>4__this).gameObject.transform;
					<>8__1.groundhalf = (GameObject[])(object)new GameObject[5] { <>4__this.pos8, <>4__this.pos9, <>4__this.pos10, <>4__this.pos11, <>4__this.pos12 };
					<>8__1.tophalf = (GameObject[])(object)new GameObject[5] { <>4__this.pos1, <>4__this.pos2, <>4__this.pos3, <>4__this.pos4, <>4__this.pos5 };
					<>4__this._control.GetState("Set Phase 2").AddMethod(delegate
					{
						//IL_0033: Unknown result type (might be due to invalid IL or missing references)
						//IL_0034: Unknown result type (might be due to invalid IL or missing references)
						//IL_0049: 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_0072: Unknown result type (might be due to invalid IL or missing references)
						//IL_0093: Unknown result type (might be due to invalid IL or missing references)
						//IL_0098: Unknown result type (might be due to invalid IL or missing references)
						//IL_0099: Unknown result type (might be due to invalid IL or missing references)
						//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
						//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
						//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
						Vector3 val5 = default(Vector3);
						((Vector3)(ref val5))..ctor(0.75f, 0.75f, 0.75f);
						Vector3 val6 = default(Vector3);
						((Vector3)(ref val6))..ctor(0f, 0.8f, 0f);
						<>8__1.<>4__this.currentscale = val5;
						<>8__1.<>4__this.dancerA.transform.localScale = val5;
						<>8__1.<>4__this.dancerB.transform.localScale = val5;
						<>8__1.ringholder.transform.localScale = val5;
						GameObject[] tophalf2 = <>8__1.tophalf;
						foreach (GameObject val7 in tophalf2)
						{
							Transform transform33 = val7.transform;
							transform33.position += val6;
						}
						GameObject[] groundhalf2 = <>8__1.groundhalf;
						foreach (GameObject val8 in groundhalf2)
						{
							Transform transform34 = val8.transform;
							transform34.position -= val6;
						}
					});
					<>4__this._control.GetState("Set Phase 3").AddMethod(delegate
					{
						//IL_0033: Unknown result type (might be due to invalid IL or missing references)
						//IL_0034: Unknown result type (might be due to invalid IL or missing references)
						//IL_0049: 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_0072: Unknown result type (might be due to invalid IL or missing references)
						//IL_0093: Unknown result type (might be due to invalid IL or missing references)
						//IL_0098: Unknown result type (might be due to invalid IL or missing references)
						//IL_0099: Unknown result type (might be due to invalid IL or missing references)
						//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
						//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
						//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
						Vector3 val = default(Vector3);
						((Vector3)(ref val))..ctor(0.5f, 0.5f, 0.5f);
						Vector3 val2 = default(Vector3);
						((Vector3)(ref val2))..ctor(0f, 0.8f, 0f);
						<>8__1.<>4__this.currentscale = val;
						<>8__1.<>4__this.dancerA.transform.localScale = val;
						<>8__1.<>4__this.dancerB.transform.localScale = val;
						<>8__1.ringholder.transform.localScale = val;
						GameObject[] tophalf = <>8__1.tophalf;
						foreach (GameObject val3 in tophalf)
						{
							Transform transform31 = val3.transform;
							transform31.position += val2;
						}
						GameObject[] groundhalf = <>8__1.groundhalf;
						foreach (GameObject val4 in groundhalf)
						{
							Transform transform32 = val4.transform;
							transform32.position -= val2;
						}
					});
					<deathstate>5__6 = <>4__this._control.GetState("Dancer Death");
					<deathstate>5__6.RemoveAction(6);
					<deathstate>5__6.RemoveAction(5);
					<deathstate>5__6.RemoveAction(4);
					<deathstate>5__6.RemoveAction(3);
					<deathstate>5__6.RemoveAction(2);
					<deathstate>5__6.AddMethod(delegate
					{
						<>8__1.<>4__this.dancerA_control.SendEvent("DIE");
						<>8__1.<>4__this.dancerB_control.SendEvent("DIE");
						<>8__1.<>4__this._control.fsm.GetFsmInt("Dancers Killed").value = 2;
					});
					if (<>4__this.order == 0)
					{
						<>4__this._control.GetState("Windup 1").AddMethod(delegate
						{
							HealthSharePatch.PhaseHPsetter(900);
						});
						<>4__this._control.GetState("Set Phase 2").AddMethod(delegate
						{
							HealthSharePatch.PhaseHPsetter(1500);
						});
						<>4__this._control.GetState("Set Phase 3").AddMethod(delegate
						{
							HealthSharePatch.PhaseHPsetter(1800);
						});
					}
					else
					{
						Object.Destroy((Object)(object)FSMUtility.LocateMyFSM(((Component)<>4__this).gameObject, "Music Control"));
						<>4__this._beat.GetState("Beat").RemoveAction(1);
					}
					if (<>4__this.order > 1)
					{
						<>4__this.dancerA.SetActive(false);
						<>4__this.dancerB.SetActive(false);
						<>4__this.dancerA_control.fsm.GetFsmBool("Did Roar").value = true;
						<>4__this.dancerB_control.fsm.GetFsmBool("Did Roar").value = true;
						if (<>4__this.order < 4)
						{
							<>4__this._control.GetState("Set Phase 2").AddMethod(delegate
							{
								<>8__1.<>4__this.dancerA.SetActive(true);
								<>8__1.<>4__this.dancerB.SetActive(true);
							});
						}
						else
						{
							<>4__this._control.GetState("Set Phase 3").AddMethod(delegate
							{
								<>8__1.<>4__this.dancerA.SetActive(true);
								<>8__1.<>4__this.dancerB.SetActive(true);
							});
							<>s__9 = <>8__1.tophalf;
							for (<>s__10 = 0; <>s__10 < <>s__9.Length; <>s__10++)
							{
								<pos>5__11 = <>s__9[<>s__10];
								Transform transform = <pos>5__11.transform;
								transform.position += new Vector3(0f, -3.5f, 0f);
								<pos>5__11 = null;
							}
							<>s__9 = null;
							<>s__12 = <>8__1.groundhalf;
							for (<>s__13 = 0; <>s__13 < <>s__12.Length; <>s__13++)
							{
								<pos>5__14 = <>s__12[<>s__13];
								Transform transform2 = <pos>5__14.transform;
								transform2.position += new Vector3(0f, 3.5f, 0f);
								<pos>5__14 = null;
							}
							<>s__12 = null;
						}
					}
					<emergeA>5__7 = <>4__this.dancerA_control.GetState("Emerge");
					<emergeB>5__8 = <>4__this.dancerB_control.GetState("Emerge");
					int order = <>4__this.order;
					<>s__15 = order;
					switch (<>s__15)
					{
					case 0:
					{
						Transform transform29 = <>4__this.dancerA.transform;
						transform29.position += new Vector3(-0.5f, 0f);
						Transform transform30 = <>4__this.dancerB.transform;
						transform30.position += new Vector3(-0.5f, 0f);
						break;
					}
					case 1:
					{
						<>4__this._control.ChangeTransition("Start Phase 1", "FINISHED", "Sequence 1A 5");
						<delaystate>5__2.AddAction(<OrderModifier>g__Waiter|23_0(0.5f));
						Transform transform27 = <>4__this.dancerA.transform;
						transform27.position += new Vector3(0.5f, 0f);
						Transform transform28 = <>4__this.dancerB.transform;
						transform28.position += new Vector3(0.5f, 0f);
						<>4__this.dancerA_control.fsm.GetFsmGameObject("Start Pos").value = <>4__this.pos11;
						<>4__this.dancerB_control.fsm.GetFsmGameObject("Start Pos").value = <>4__this.pos9;
						<emergeA>5__7.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos11);
						<emergeB>5__8.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos9);
						break;
					}
					case 2:
					{
						<>4__this._control.ChangeTransition("Start Phase 2", "FINISHED", "Sequence 1C 3");
						<delaystate>5__2.AddAction(<OrderModifier>g__Waiter|23_0(0.25f));
						Transform transform23 = <>4__this.dancerA.transform;
						transform23.position += new Vector3(0f, 1.5f);
						Transform transform24 = <>4__this.dancerB.transform;
						transform24.position += new Vector3(0f, 1.5f);
						<>4__this.dancerA_control.fsm.GetFsmGameObject("Current Pos").value = <>4__this.pos5;
						<>4__this.dancerB_control.fsm.GetFsmGameObject("Current Pos").value = <>4__this.pos1;
						<emergeA>5__7.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos5);
						<emergeB>5__8.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos1);
						Transform transform25 = <>4__this.centre.transform;
						transform25.position += new Vector3(5f, 0f);
						Transform transform26 = <>8__1.ringholder.transform;
						transform26.position += new Vector3(5f, 0f);
						break;
					}
					case 3:
					{
						<>4__this._control.ChangeTransition("Start Phase 2", "FINISHED", "Sequence 2A 1");
						<delaystate>5__2.AddAction(<OrderModifier>g__Waiter|23_0(0.75f));
						Transform transform19 = <>4__this.dancerA.transform;
						transform19.position += new Vector3(0f, -1.5f);
						Transform transform20 = <>4__this.dancerB.transform;
						transform20.position += new Vector3(0f, -1.5f);
						<>4__this.dancerA_control.fsm.GetFsmGameObject("Current Pos").value = <>4__this.pos2;
						<>4__this.dancerB_control.fsm.GetFsmGameObject("Current Pos").value = <>4__this.pos4;
						<emergeA>5__7.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos2);
						<emergeB>5__8.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos4);
						Transform transform21 = <>4__this.centre.transform;
						transform21.position += new Vector3(-5f, 0f);
						Transform transform22 = <>8__1.ringholder.transform;
						transform22.position += new Vector3(-5f, 0f);
						break;
					}
					case 4:
					{
						<>4__this._control.ChangeTransition("Start Phase 3", "FINISHED", "Sequence 1C 1");
						<delaystate>5__2.AddAction(<OrderModifier>g__Waiter|23_0(0.125f));
						Transform transform15 = <>4__this.dancerA.transform;
						transform15.position += new Vector3(0.5f, 1.5f);
						Transform transform16 = <>4__this.dancerB.transform;
						transform16.position += new Vector3(0.5f, 1.5f);
						<>4__this.dancerA_control.fsm.GetFsmGameObject("Start Pos").value = <>4__this.pos8;
						<>4__this.dancerB_control.fsm.GetFsmGameObject("Start Pos").value = <>4__this.pos12;
						<emergeA>5__7.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos8);
						<emergeB>5__8.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos12);
						Transform transform17 = <>4__this.centre.transform;
						transform17.position += new Vector3(3f, 2f);
						Transform transform18 = <>8__1.ringholder.transform;
						transform18.position += new Vector3(3f, 2f);
						break;
					}
					case 5:
					{
						<>4__this._control.ChangeTransition("Start Phase 3", "FINISHED", "Sequence 1A 5");
						<delaystate>5__2.AddAction(<OrderModifier>g__Waiter|23_0(0.375f));
						Transform transform11 = <>4__this.dancerA.transform;
						transform11.position += new Vector3(-0.5f, -1.5f);
						Transform transform12 = <>4__this.dancerB.transform;
						transform12.position += new Vector3(-0.5f, -1.5f);
						<>4__this.dancerA_control.fsm.GetFsmGameObject("Start Pos").value = <>4__this.pos11;
						<>4__this.dancerB_control.fsm.GetFsmGameObject("Start Pos").value = <>4__this.pos9;
						<emergeA>5__7.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos11);
						<emergeB>5__8.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos9);
						Transform transform13 = <>4__this.centre.transform;
						transform13.position += new Vector3(-3f, -2f);
						Transform transform14 = <>8__1.ringholder.transform;
						transform14.position += new Vector3(-3f, -2f);
						break;
					}
					case 6:
					{
						<>4__this._control.ChangeTransition("Start Phase 3", "FINISHED", "Sequence 2E 15");
						<delaystate>5__2.AddAction(<OrderModifier>g__Waiter|23_0(0.625f));
						Transform transform7 = <>4__this.dancerA.transform;
						transform7.position += new Vector3(-0.5f, 1.5f);
						Transform transform8 = <>4__this.dancerB.transform;
						transform8.position += new Vector3(-0.5f, 1.5f);
						<>4__this.dancerA_control.fsm.GetFsmGameObject("Current Pos").value = <>4__this.pos1;
						<>4__this.dancerB_control.fsm.GetFsmGameObject("Current Pos").value = <>4__this.pos5;
						<emergeA>5__7.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos1);
						<emergeB>5__8.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos5);
						Transform transform9 = <>4__this.centre.transform;
						transform9.position += new Vector3(-3f, 2f);
						Transform transform10 = <>8__1.ringholder.transform;
						transform10.position += new Vector3(-3f, 2f);
						break;
					}
					case 7:
					{
						<>4__this._control.ChangeTransition("Start Phase 3", "FINISHED", "Sequence 4D 5");
						<delaystate>5__2.AddAction(<OrderModifier>g__Waiter|23_0(0.875f));
						Transform transform3 = <>4__this.dancerA.transform;
						transform3.position += new Vector3(0.5f, -1.5f);
						Transform transform4 = <>4__this.dancerB.transform;
						transform4.position += new Vector3(0.5f, -1.5f);
						<>4__this.dancerA_control.fsm.GetFsmGameObject("Current Pos").value = <>4__this.pos4;
						<>4__this.dancerB_control.fsm.GetFsmGameObject("Current Pos").value = <>4__this.pos2;
						<emergeA>5__7.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos4);
						<emergeB>5__8.GetAction<GetPosition>(9).gameObject = <OrderModifier>g__FsmGO|23_2(<>4__this.pos2);
						Transform transform5 = <>4__this.centre.transform;
						transform5.position += new Vector3(3f, -2f);
						Transform transform6 = <>8__1.ringholder.transform;
						transform6.position += new Vector3(3f, -2f);
						break;
					}
					}
					<>4__this.dancerA_control.fsm.GetFsmVector3("Rest Pos").value = <>4__this.dancerA.transform.position;
					<>4__this.dancerB_control.fsm.GetFsmVector3("Rest Pos").value = <>4__this.dancerB.transform.position;
					<>4__this.dancerA_control.fsm.GetFsmVector3("Return Pos").value = <>4__this.dancerA.transform.position;
					<>4__this.dancerB_control.fsm.GetFsmVector3("Return Pos").value = <>4__this.dancerB.transform.position;
					<>4__this.dancerA_control.GetState("OB Pause").GetAction<Wait>(0).time = FsmFloat.op_Implicit(0.25f);
					<>4__this.dancerB_control.GetState("OB Pause").GetAction<Wait>(0).time = FsmFloat.op_Implicit(0.25f);
					<>4__this.dancerA_control.AddMethod("Primary Return", delegate
					{
						//IL_0017: Unknown result type (might be due to invalid IL or missing references)
						//IL_0038: Unknown result type (might be due to invalid IL or missing references)
						<>8__1.<>4__this.dancerA.transform.localScale = <>8__1.<>4__this.currentscale;
						<>8__1.<>4__this.dancerB.transform.localScale = <>8__1.<>4__this.currentscale;
					});
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private GameObject dancerA = null;

		private GameObject dancerB = null;

		private GameObject pos1 = null;

		private GameObject pos2 = null;

		private GameObject pos3 = null;

		private GameObject pos4 = null;

		private GameObject pos5 = null;

		private GameObject pos6 = null;

		private GameObject pos7 = null;

		private GameObject pos8 = null;

		private GameObject pos9 = null;

		private GameObject pos10 = null;

		private GameObject pos11 = null;

		private GameObject pos12 = null;

		private GameObject centre = null;

		private PlayMakerFSM _control = null;

		private PlayMakerFSM _beat = null;

		private PlayMakerFSM dancerA_control = null;

		private PlayMakerFSM dancerB_control = null;

		private int order = 0;

		private Vector3 currentscale = new Vector3(1f, 1f, 1f);

		private void Start()
		{
			_control = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Control");
			_beat = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Beat Control");
			dancerA = ((Component)((Component)this).gameObject.transform.Find("Dancer A")).gameObject;
			dancerB = ((Component)((Component)this).gameObject.transform.Find("Dancer B")).gameObject;
			dancerA_control = FSMUtility.LocateMyFSM(dancerA, "Control");
			dancerB_control = FSMUtility.LocateMyFSM(dancerB, "Control");
			order = Array.IndexOf(BossPatches.AllDancers, ((Component)this).gameObject);
			BaseModifier();
			((MonoBehaviour)this).StartCoroutine(OrderModifier());
			ShareStun();
		}

		private void BaseModifier()
		{
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			_control.GetState("Set Phase 2").RemoveAction(1);
			_control.GetState("Set Phase 2").RemoveAction(0);
			_control.GetState("Set Phase 3").RemoveAction(1);
			_control.GetState("Set Phase 3").RemoveAction(0);
			pos1 = ((Component)((Component)this).gameObject.transform.Find("Pos1")).gameObject;
			pos2 = ((Component)((Component)this).gameObject.transform.Find("Pos2")).gameObject;
			pos3 = ((Component)((Component)this).gameObject.transform.Find("Pos3")).gameObject;
			pos4 = ((Component)((Component)this).gameObject.transform.Find("Pos4")).gameObject;
			pos5 = ((Component)((Component)this).gameObject.transform.Find("Pos5")).gameObject;
			pos6 = ((Component)((Component)this).gameObject.transform.Find("Pos6")).gameObject;
			pos7 = ((Component)((Component)this).gameObject.transform.Find("Pos7")).gameObject;
			pos8 = ((Component)((Component)this).gameObject.transform.Find("Pos8")).gameObject;
			pos9 = ((Component)((Component)this).gameObject.transform.Find("Pos9")).gameObject;
			pos10 = ((Component)((Component)this).gameObject.transform.Find("Pos10")).gameObject;
			pos11 = ((Component)((Component)this).gameObject.transform.Find("Pos11")).gameObject;
			pos12 = ((Component)((Component)this).gameObject.transform.Find("Pos12")).gameObject;
			centre = ((Component)((Component)this).gameObject.transform.Find("Centre")).gameObject;
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(2.3f, 0f, 0f);
			Transform transform = pos1.transform;
			transform.position -= val;
			Transform transform2 = pos5.transform;
			transform2.position += val;
			Transform transform3 = pos8.transform;
			transform3.position -= val;
			Transform transform4 = pos12.transform;
			transform4.position += val;
		}

		[IteratorStateMachine(typeof(<OrderModifier>d__23))]
		private IEnumerator OrderModifier()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OrderModifier>d__23(0)
			{
				<>4__this = this
			};
		}

		private void ShareStun()
		{
			//IL_002f: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			PlayMakerFSM[] array = (PlayMakerFSM[])(object)new PlayMakerFSM[2] { dancerA_control, dancerB_control };
			foreach (PlayMakerFSM fsm in array)
			{
				fsm.GetState("Stun Stagger").AddAction((FsmStateAction)new SendEventByName
				{
					eventTarget = new FsmEventTarget
					{
						target = (EventTarget)4
					},
					sendEvent = FsmString.op_Implicit("DANCER STUNNED"),
					delay = FsmFloat.op_Implicit(0f),
					everyFrame = false
				});
			}
		}

		[CompilerGenerated]
		internal static FsmStateAction <OrderModifier>g__Waiter|23_0(float time)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			return (FsmStateAction)new Wait
			{
				time = FsmFloat.op_Implicit(time),
				finishEvent = FsmEvent.Finished
			};
		}

		[CompilerGenerated]
		internal static FsmOwnerDefault <OrderModifier>g__FsmGO|23_2(GameObject go)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001a: Expected O, but got Unknown
			return new FsmOwnerDefault
			{
				ownerOption = (OwnerDefaultOption)1,
				gameObject = FsmGameObject.op_Implicit(go)
			};
		}
	}
}