using System;
using Cpp2IlInjected;
using UnityEngine;

// Token: 0x02000166 RID: 358
[Token(Token = "0x2000166")]
public class DoorSwitch : PassiveEvent
{
	// Token: 0x060011E3 RID: 4579 RVA: 0x00028C0C File Offset: 0x00026E0C
	[Token(Token = "0x60011E3")]
	[Address(RVA = "0xA57890", Offset = "0xA56690", VA = "0x180A57890", Slot = "4")]
	protected override void Start()
	{
		base..ctor();
		BoxCollider bc = this.BC;
		int num = 0;
		if (!(bc == num))
		{
			this.BC.isTrigger = true;
		}
		Debug.LogError("找不到碰撞");
		Animator ani = this.Ani;
		int num2 = 0;
		if (ani == num2)
		{
			Debug.LogError("找不到動畫");
		}
		GameObject seobject = this.SEObject;
		Transform transform = base.transform;
		SoundEffect soundEffectOfPrefabs = Common.GetSoundEffectOfPrefabs(seobject, transform);
		this.g_SE = soundEffectOfPrefabs;
		this.g_fReciprocal = 2f;
	}

	// Token: 0x060011E4 RID: 4580 RVA: 0x00028C9C File Offset: 0x00026E9C
	[Token(Token = "0x60011E4")]
	[Address(RVA = "0xA57A80", Offset = "0xA56880", VA = "0x180A57A80", Slot = "6")]
	protected override void Update()
	{
		base.Update();
		if (!this.g_bClose && !this.BC.enabled)
		{
			float num = this.g_fReciprocal;
			int num2 = 0;
			if (num > (float)num2)
			{
				this.g_fReciprocal = num;
				SceneEvent[] openEvent = this.OpenEvent;
				int num3 = 0;
				if (openEvent != 0 && num3 < openEvent.Length)
				{
					SceneEvent sceneEvent = openEvent[num3];
					int num4 = 0;
					if (sceneEvent != num4)
					{
						this.OpenEvent[num3].OpenEvent();
					}
					SceneEvent[] openEvent2 = this.OpenEvent;
					num3++;
				}
				SceneEvent[] releaseEvent = this.ReleaseEvent;
				if (releaseEvent != 0 && num3 < releaseEvent.Length)
				{
					SceneEvent sceneEvent2 = releaseEvent[num3];
					int num5 = 0;
					if (sceneEvent2 != num5)
					{
						this.ReleaseEvent[num3].ReleaseEvent();
					}
					SceneEvent[] releaseEvent2 = this.ReleaseEvent;
					num3++;
					while (releaseEvent2 != 0)
					{
					}
				}
				OpenDoor[] door = this.Door;
				if (door != 0 && num3 < door.Length)
				{
					OpenDoor openDoor = door[num3];
					int num6 = 0;
					if (openDoor != num6)
					{
						this.Door[num3].SwitchOnDoor();
					}
					OpenDoor[] door2 = this.Door;
					num3++;
					while (door2 != 0)
					{
					}
				}
				this.g_bClose = true;
			}
		}
	}

	// Token: 0x060011E5 RID: 4581 RVA: 0x00028DE0 File Offset: 0x00026FE0
	[Token(Token = "0x60011E5")]
	[Address(RVA = "0xA57A10", Offset = "0xA56810", VA = "0x180A57A10")]
	public void SwitchOn()
	{
		BoxCollider bc = this.BC;
		int num = 0;
		bc.enabled = num != 0;
		Animator ani = this.Ani;
		int num2 = 0;
		ani.CrossFade("SwitchOn", 0.025f, num2);
	}

	// Token: 0x060011E6 RID: 4582 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60011E6")]
	[Address(RVA = "0xA57520", Offset = "0xA56320", VA = "0x180A57520")]
	public void SaveSwitchOn()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060011E7 RID: 4583 RVA: 0x00028E20 File Offset: 0x00027020
	[Token(Token = "0x60011E7")]
	[Address(RVA = "0xA57290", Offset = "0xA56090", VA = "0x180A57290")]
	public void AniPlaySwitchOnSE()
	{
		SoundEffect soundEffect = this.g_SE;
		int num = 0;
		if (soundEffect != num)
		{
			this.g_SE.PlayRandom(1f, 1f);
		}
	}

	// Token: 0x060011E8 RID: 4584 RVA: 0x00028E5C File Offset: 0x0002705C
	[Token(Token = "0x60011E8")]
	[Address(RVA = "0xA57480", Offset = "0xA56280", VA = "0x180A57480")]
	public void ResetSwitch()
	{
		BoxCollider bc = this.BC;
		this.g_fReciprocal = 2f;
		bc.enabled = true;
		if (base.gameObject.activeInHierarchy)
		{
			Animator ani = this.Ani;
			int num = 0;
			ani.CrossFade("Idle", 1f, num);
		}
		this.g_bClose = false;
	}

	// Token: 0x060011E9 RID: 4585 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60011E9")]
	[Address(RVA = "0xA57320", Offset = "0xA56120", VA = "0x180A57320")]
	public void Close()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060011EA RID: 4586 RVA: 0x00028EB8 File Offset: 0x000270B8
	[Token(Token = "0x60011EA")]
	[Address(RVA = "0xA57870", Offset = "0xA56670", VA = "0x180A57870", Slot = "7")]
	public override void SetTimeScale(float fScaleTime)
	{
		this.Ani.speed = fScaleTime;
	}

	// Token: 0x060011EB RID: 4587 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60011EB")]
	[Address(RVA = "0xA573D0", Offset = "0xA561D0", VA = "0x180A573D0")]
	private void OnEnable()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060011EC RID: 4588 RVA: 0x00028ED8 File Offset: 0x000270D8
	[Token(Token = "0x60011EC")]
	[Address(RVA = "0x3FBF80", Offset = "0x3FAD80", VA = "0x1803FBF80")]
	public DoorSwitch()
	{
	}

	// Token: 0x04001BAA RID: 7082
	[FieldOffset(Offset = "0x20")]
	[Token(Token = "0x4001BAA")]
	public Animator Ani;

	// Token: 0x04001BAB RID: 7083
	[FieldOffset(Offset = "0x28")]
	[Token(Token = "0x4001BAB")]
	public BoxCollider BC;

	// Token: 0x04001BAC RID: 7084
	[FieldOffset(Offset = "0x30")]
	[Token(Token = "0x4001BAC")]
	public GameObject SEObject;

	// Token: 0x04001BAD RID: 7085
	[FieldOffset(Offset = "0x38")]
	[Token(Token = "0x4001BAD")]
	public SceneEvent[] OpenEvent;

	// Token: 0x04001BAE RID: 7086
	[FieldOffset(Offset = "0x40")]
	[Token(Token = "0x4001BAE")]
	public SceneEvent[] ReleaseEvent;

	// Token: 0x04001BAF RID: 7087
	[FieldOffset(Offset = "0x48")]
	[Token(Token = "0x4001BAF")]
	public OpenDoor[] Door;

	// Token: 0x04001BB0 RID: 7088
	[FieldOffset(Offset = "0x50")]
	[Token(Token = "0x4001BB0")]
	private float g_fReciprocal;

	// Token: 0x04001BB1 RID: 7089
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x4001BB1")]
	private SoundEffect g_SE;

	// Token: 0x04001BB2 RID: 7090
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x4001BB2")]
	private bool g_bClose;
}
