using System;
using Cpp2IlInjected;
using UnityEngine;

// Token: 0x020001A8 RID: 424
[Token(Token = "0x20001A8")]
public class AttackableObject : MonoBehaviour
{
	// Token: 0x060013BE RID: 5054 RVA: 0x0002CC94 File Offset: 0x0002AE94
	[Token(Token = "0x60013BE")]
	[Address(RVA = "0xDB5200", Offset = "0xDB4200", VA = "0x180DB5200", 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: 0x060013BF RID: 5055 RVA: 0x0002CDB4 File Offset: 0x0002AFB4
	[Token(Token = "0x60013BF")]
	[Address(RVA = "0xDB5630", Offset = "0xDB4630", VA = "0x180DB5630", 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: 0x060013C0 RID: 5056 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60013C0")]
	[Address(RVA = "0xDB5790", Offset = "0xDB4790", VA = "0x180DB5790", Slot = "6")]
	protected virtual void Update()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060013C1 RID: 5057 RVA: 0x0002CE18 File Offset: 0x0002B018
	[Token(Token = "0x60013C1")]
	[Address(RVA = "0xDB54E0", Offset = "0xDB44E0", VA = "0x180DB54E0", 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: 0x060013C2 RID: 5058 RVA: 0x0002CE74 File Offset: 0x0002B074
	[Token(Token = "0x60013C2")]
	[Address(RVA = "0xDB54C0", Offset = "0xDB44C0", VA = "0x180DB54C0", Slot = "8")]
	protected virtual void LateUpdate()
	{
		this.g_Shake.Update();
	}

	// Token: 0x060013C3 RID: 5059 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60013C3")]
	[Address(RVA = "0xDB4D30", Offset = "0xDB3D30", VA = "0x180DB4D30", Slot = "9")]
	public virtual void HitPhysical(AttackData AD)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060013C4 RID: 5060 RVA: 0x0002CE94 File Offset: 0x0002B094
	[Token(Token = "0x60013C4")]
	[Address(RVA = "0xDB4C30", Offset = "0xDB3C30", VA = "0x180DB4C30", 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: 0x060013C5 RID: 5061 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60013C5")]
	[Address(RVA = "0x29E8B0", Offset = "0x29D8B0", VA = "0x18029E8B0", Slot = "11")]
	public virtual void SetTimeScale(float fTimeScale)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060013C6 RID: 5062 RVA: 0x0002CF24 File Offset: 0x0002B124
	[Token(Token = "0x60013C6")]
	[Address(RVA = "0xDB4BE0", Offset = "0xDB3BE0", VA = "0x180DB4BE0")]
	protected float GetWorldDeltaTime()
	{
		return Game.GetStageDeltaTime();
	}

	// Token: 0x060013C7 RID: 5063 RVA: 0x0002CF38 File Offset: 0x0002B138
	[Token(Token = "0x60013C7")]
	[Address(RVA = "0xDB4B70", Offset = "0xDB3B70", VA = "0x180DB4B70")]
	public AttackableObject()
	{
		Shake shake = new Shake();
		this.g_Shake = shake;
		base..ctor();
	}

	// Token: 0x04001DD4 RID: 7636
	[FieldOffset(Offset = "0x18")]
	[Token(Token = "0x4001DD4")]
	public AttackableObject.ObjectType Type;

	// Token: 0x04001DD5 RID: 7637
	[FieldOffset(Offset = "0x1C")]
	[Token(Token = "0x4001DD5")]
	public float HP;

	// Token: 0x04001DD6 RID: 7638
	[FieldOffset(Offset = "0x20")]
	[Token(Token = "0x4001DD6")]
	protected float g_fHPMax;

	// Token: 0x04001DD7 RID: 7639
	[FieldOffset(Offset = "0x24")]
	[Token(Token = "0x4001DD7")]
	protected float g_fHPUnderScale = 1f;

	// Token: 0x04001DD8 RID: 7640
	[FieldOffset(Offset = "0x28")]
	[Token(Token = "0x4001DD8")]
	protected float g_fHPAlpha;

	// Token: 0x04001DD9 RID: 7641
	[FieldOffset(Offset = "0x2C")]
	[Token(Token = "0x4001DD9")]
	protected float g_fHPShowTime;

	// Token: 0x04001DDA RID: 7642
	[Token(Token = "0x4001DDA")]
	protected const float g_fHPShowTimeMax = 10f;

	// Token: 0x04001DDB RID: 7643
	[FieldOffset(Offset = "0x30")]
	[Token(Token = "0x4001DDB")]
	public Transform HPBarPoint;

	// Token: 0x04001DDC RID: 7644
	[FieldOffset(Offset = "0x38")]
	[Token(Token = "0x4001DDC")]
	protected GameObject uiHPBar;

	// Token: 0x04001DDD RID: 7645
	[FieldOffset(Offset = "0x40")]
	[Token(Token = "0x4001DDD")]
	protected Shake g_Shake;

	// Token: 0x04001DDE RID: 7646
	[FieldOffset(Offset = "0x48")]
	[Token(Token = "0x4001DDE")]
	protected SoundEffect soundEffect;

	// Token: 0x04001DDF RID: 7647
	[FieldOffset(Offset = "0x50")]
	[Token(Token = "0x4001DDF")]
	protected float g_fDeltaTime;

	// Token: 0x04001DE0 RID: 7648
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x4001DE0")]
	protected EnemyHpHandler hpBarInstance;

	// Token: 0x04001DE1 RID: 7649
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x4001DE1")]
	public int Id;

	// Token: 0x020001A9 RID: 425
	[Token(Token = "0x20001A9")]
	public enum ObjectType
	{
		// Token: 0x04001DE3 RID: 7651
		[Token(Token = "0x4001DE3")]
		Null,
		// Token: 0x04001DE4 RID: 7652
		[Token(Token = "0x4001DE4")]
		ReplyMana,
		// Token: 0x04001DE5 RID: 7653
		[Token(Token = "0x4001DE5")]
		SwitchDevice,
		// Token: 0x04001DE6 RID: 7654
		[Token(Token = "0x4001DE6")]
		DamageObject,
		// Token: 0x04001DE7 RID: 7655
		[Token(Token = "0x4001DE7")]
		TreasureBox
	}
}
