using UnityEngine;
using Wizard.Battle.View.Vfx;

namespace Wizard.Battle.Player.ClassCharacter;

public class Enemy3dClassCharacter : Class3dCharacterBase
{
	private readonly Vector3 PP_PANEL_POSITION = new Vector3(0f, -34.22f, -29.25f);

	private readonly Vector3 WIDGET_POSITION = new Vector3(0f, 490f, 30f);

	private readonly int WIDGET_OFFSET_TOP = -1162;

	private readonly int WIDGET_OFFSET_BOTTOM = 195;

	protected override Vector3 MessagePosition => _initPosition + new Vector3(0f, -0.3f, 0f);

	public Enemy3dClassCharacter(int classId)
	{
		_classCharacterId = classId;
		IsPlayer = false;
	}

	public override VfxBase CreateLoadResouceVfx()
	{
		SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
		sequentialVfxPlayer.Register(base.CreateLoadResouceVfx());
		sequentialVfxPlayer.Register(InstantVfx.Create(delegate
		{
			_root.transform.localPosition = Vector3.left * 10f;
			base.GameObject.transform.Find("Collider").gameObject.GetComponent<BoxCollider>().size = new Vector3(3.8f, 3.9f, 0.2f);
		}));
		return sequentialVfxPlayer;
	}

	protected override string GetTagName()
	{
		return "Enemy";
	}

	protected override Quaternion ConvertBackPanelRotation(Quaternion originalRotation)
	{
		return Quaternion.Euler(0f, -180f, 180f);
	}

	protected override Vector3 GetPosition()
	{
		return Global.CLASS_BATTLE_POSITION_ENEMY;
	}

	protected override void SetUpAnchor(GameObject o)
	{
		o.transform.localPosition = WIDGET_POSITION;
		UIWidget uIWidget = o.AddComponent<UIWidget>();
		uIWidget.topAnchor.relative = 1f;
		uIWidget.topAnchor.absolute = WIDGET_OFFSET_TOP;
		Transform target = BattleManagerBase.GetIns().Battle3DContainer.transform.Find("Camera");
		uIWidget.topAnchor.target = target;
		uIWidget.bottomAnchor.target = target;
		uIWidget.bottomAnchor.relative = 0.5f;
		uIWidget.bottomAnchor.absolute = WIDGET_OFFSET_BOTTOM;
	}

	protected override void AttachOtherUI(GameObject o)
	{
		BattleManagerBase.GetIns().BattleEnemy.BattleView.EpPanel.transform.parent = o.transform;
		EnemyStatusPanelControl enemyStatusPanelControl = BattleManagerBase.GetIns().BattleEnemy.StatusPanelControl as EnemyStatusPanelControl;
		if ((bool)enemyStatusPanelControl)
		{
			enemyStatusPanelControl.ChangePPPanelParent(o.transform, PP_PANEL_POSITION);
		}
	}
}
