using System;
using Cpp2IlInjected;
using UnityEngine;

// Token: 0x0200017A RID: 378
[Token(Token = "0x200017A")]
public class AttackableObject : MonoBehaviour
{
	// Token: 0x0600123A RID: 4666 RVA: 0x000299B8 File Offset: 0x00027BB8
	[Token(Token = "0x600123A")]
	[Address(RVA = "0x8D08C0", Offset = "0x8CF6C0", VA = "0x1808D08C0", Slot = "4")]
	public virtual void Init()
	{
		SoundEffect component = base.GetComponent<SoundEffect>();
		this.soundEffect = component;
		SoundEffect soundEffect = this.soundEffect;
		int num = 0;
		if (soundEffect != num)
		{
			this.soundEffect.InitData("SoundEffect");
			Game.BindStageTimeScale(this.soundEffect);
		}
		if (this.Type <= AttackableObject.ObjectType.ReplyMana)
		{
			Shake shake = this.g_Shake;
			Transform transform = base.transform;
			int num2 = 0;
			shake.Start(transform, num2 != 0);
		}
		Transform hpbarPoint = this.HPBarPoint;
		int num3 = 0;
		if (!(hpbarPoint != num3))
		{
		}
		GameObject enemyHpPrefab = Game.GetUIEnemyHp().enemyHpPrefab;
		Transform transform2 = Game.GetUIEnemyHp().transform;
		GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(enemyHpPrefab, transform2);
		this.uiHPBar = gameObject;
		GameObject gameObject2 = this.uiHPBar;
		int num4 = 0;
		if (gameObject2 == num4)
		{
			Debug.LogError("破壞物件UI錯誤");
		}
		EnemyHpHandler component2 = this.uiHPBar.GetComponent<EnemyHpHandler>();
		this.hpBarInstance = component2;
		GameObject gameObject3 = this.uiHPBar;
		int num5 = 0;
		gameObject3.SetActive(num5 != 0);
		float hp = this.HP;
		this.g_fHPMax = hp;
		this.Id = (int)((ulong)0L);
	}

	// Token: 0x0600123B RID: 4667 RVA: 0x00029AD8 File Offset: 0x00027CD8
	[Token(Token = "0x600123B")]
	[Address(RVA = "0x8D0CF0", Offset = "0x8CFAF0", VA = "0x1808D0CF0", Slot = "5")]
	protected virtual void OnEnable()
	{
		if (base.CompareTag("AttackableObject"))
		{
			Game.sceneManager.AddAttackable(this);
		}
		SoundEffect soundEffect = this.soundEffect;
		int num = 0;
		if (soundEffect != num)
		{
			SoundEffect soundEffect2 = this.soundEffect;
			if (soundEffect2.Loop)
			{
				int num2 = 0;
				soundEffect2.Play(num2, 1f, 1f);
			}
		}
	}

	// Token: 0x0600123C RID: 4668 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600123C")]
	[Address(RVA = "0x8D0E50", Offset = "0x8CFC50", VA = "0x1808D0E50", Slot = "6")]
	protected virtual void Update()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600123D RID: 4669 RVA: 0x00029B3C File Offset: 0x00027D3C
	[Token(Token = "0x600123D")]
	[Address(RVA = "0x8D0BA0", Offset = "0x8CF9A0", VA = "0x1808D0BA0", Slot = "7")]
	protected virtual void OnDisable()
	{
		if (base.CompareTag("AttackableObject"))
		{
			Game.sceneManager.RemoveAttackable(this);
		}
		SoundEffect soundEffect = this.soundEffect;
		int num = 0;
		if (soundEffect != num && this.soundEffect.GetIsPlaying())
		{
			this.soundEffect.Stop();
			return;
		}
	}

	// Token: 0x0600123E RID: 4670 RVA: 0x00029B98 File Offset: 0x00027D98
	[Token(Token = "0x600123E")]
	[Address(RVA = "0x8D0B80", Offset = "0x8CF980", VA = "0x1808D0B80", Slot = "8")]
	protected virtual void LateUpdate()
	{
		this.g_Shake.Update();
	}

	// Token: 0x0600123F RID: 4671 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600123F")]
	[Address(RVA = "0x8D03F0", Offset = "0x8CF1F0", VA = "0x1808D03F0", Slot = "9")]
	public virtual void HitPhysical(AttackData AD)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001240 RID: 4672 RVA: 0x00029BB8 File Offset: 0x00027DB8
	[Token(Token = "0x6001240")]
	[Address(RVA = "0x8D02F0", Offset = "0x8CF0F0", VA = "0x1808D02F0", Slot = "10")]
	public virtual void HitMagic(AttackData AD)
	{
		Shake shake = this.g_Shake;
		int num = 0;
		ulong num2;
		shake.SetRandomShake(0.2f, 6f, 0.6f, (float)num, num2 != 0UL);
		AttackableObject.ObjectType type = this.Type;
		if (type == AttackableObject.ObjectType.DamageObject || type == AttackableObject.ObjectType.TreasureBox)
		{
			float hp = this.HP;
			this.HP = hp;
		}
		GameObject gameObject = this.uiHPBar;
		int num3 = 0;
		if (gameObject != num3)
		{
			this.uiHPBar.SetActive(true);
			this.g_fHPAlpha = 1f;
			this.g_fHPShowTime = 10f;
		}
	}

	// Token: 0x06001241 RID: 4673 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001241")]
	[Address(RVA = "0x297F00", Offset = "0x296D00", VA = "0x180297F00", Slot = "11")]
	public virtual void SetTimeScale(float fTimeScale)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001242 RID: 4674 RVA: 0x00029C48 File Offset: 0x00027E48
	[Token(Token = "0x6001242")]
	[Address(RVA = "0x8D02A0", Offset = "0x8CF0A0", VA = "0x1808D02A0")]
	protected float GetWorldDeltaTime()
	{
		return Game.GetStageDeltaTime();
	}

	// Token: 0x06001243 RID: 4675 RVA: 0x00029C5C File Offset: 0x00027E5C
	[Token(Token = "0x6001243")]
	[Address(RVA = "0x8D10C0", Offset = "0x8CFEC0", VA = "0x1808D10C0")]
	public AttackableObject()
	{
		Shake shake = new Shake();
		this.g_Shake = shake;
		base..ctor();
	}

	// Token: 0x04001C36 RID: 7222
	[FieldOffset(Offset = "0x18")]
	[Token(Token = "0x4001C36")]
	public AttackableObject.ObjectType Type;

	// Token: 0x04001C37 RID: 7223
	[FieldOffset(Offset = "0x1C")]
	[Token(Token = "0x4001C37")]
	public float HP;

	// Token: 0x04001C38 RID: 7224
	[FieldOffset(Offset = "0x20")]
	[Token(Token = "0x4001C38")]
	protected float g_fHPMax;

	// Token: 0x04001C39 RID: 7225
	[FieldOffset(Offset = "0x24")]
	[Token(Token = "0x4001C39")]
	protected float g_fHPUnderScale = 1f;

	// Token: 0x04001C3A RID: 7226
	[FieldOffset(Offset = "0x28")]
	[Token(Token = "0x4001C3A")]
	protected float g_fHPAlpha;

	// Token: 0x04001C3B RID: 7227
	[FieldOffset(Offset = "0x2C")]
	[Token(Token = "0x4001C3B")]
	protected float g_fHPShowTime;

	// Token: 0x04001C3C RID: 7228
	[Token(Token = "0x4001C3C")]
	protected const float g_fHPShowTimeMax = 10f;

	// Token: 0x04001C3D RID: 7229
	[FieldOffset(Offset = "0x30")]
	[Token(Token = "0x4001C3D")]
	public Transform HPBarPoint;

	// Token: 0x04001C3E RID: 7230
	[FieldOffset(Offset = "0x38")]
	[Token(Token = "0x4001C3E")]
	protected GameObject uiHPBar;

	// Token: 0x04001C3F RID: 7231
	[FieldOffset(Offset = "0x40")]
	[Token(Token = "0x4001C3F")]
	protected Shake g_Shake;

	// Token: 0x04001C40 RID: 7232
	[FieldOffset(Offset = "0x48")]
	[Token(Token = "0x4001C40")]
	protected SoundEffect soundEffect;

	// Token: 0x04001C41 RID: 7233
	[FieldOffset(Offset = "0x50")]
	[Token(Token = "0x4001C41")]
	protected float g_fDeltaTime;

	// Token: 0x04001C42 RID: 7234
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x4001C42")]
	protected EnemyHpHandler hpBarInstance;

	// Token: 0x04001C43 RID: 7235
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x4001C43")]
	public int Id;

	// Token: 0x0200017B RID: 379
	[Token(Token = "0x200017B")]
	public enum ObjectType
	{
		// Token: 0x04001C45 RID: 7237
		[Token(Token = "0x4001C45")]
		Null,
		// Token: 0x04001C46 RID: 7238
		[Token(Token = "0x4001C46")]
		ReplyMana,
		// Token: 0x04001C47 RID: 7239
		[Token(Token = "0x4001C47")]
		SwitchDevice,
		// Token: 0x04001C48 RID: 7240
		[Token(Token = "0x4001C48")]
		DamageObject,
		// Token: 0x04001C49 RID: 7241
		[Token(Token = "0x4001C49")]
		TreasureBox
	}
}
