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

public class BattleCamera
{
	public UICamera m_CutInCamera;

	public Camera Camera;

	public Camera _backgroundCamera;

	public Vector3 BattleCameraPos { get; private set; }

	public Vector3 BattleCameraRot { get; private set; }

	public BattleCamera()
	{
		Camera = null;
	}

	public void SetUp(Camera camera, UICamera cutInCamera, Camera backgroundCamera)
	{
		Camera = camera;
		m_CutInCamera = cutInCamera;
		_backgroundCamera = backgroundCamera;
		BattleCameraPos = Camera.transform.localPosition;
		BattleCameraRot = Camera.transform.eulerAngles;
	}

	public VfxBase ShakeCamera(Vector3 amount, float time, float delay)
	{
		ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
		parallelVfxPlayer.Register(InstantVfx.Create(delegate
		{
			iTween.ShakePosition(Camera.gameObject, iTween.Hash("amount", amount, "time", time, "delay", delay));
		}));
		return parallelVfxPlayer;
	}

	public static VfxBase ShakeCameraGameObject(GameObject obj, Vector3 amount, float time, float delay)
	{
		ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
		parallelVfxPlayer.Register(InstantVfx.Create(delegate
		{
			iTween.ShakePosition(obj, iTween.Hash("amount", amount, "time", time, "delay", delay));
		}));
		return parallelVfxPlayer;
	}

	public VfxBase ShakeComplete()
	{
		return InstantVfx.Create(delegate
		{
			Camera.transform.localPosition = BattleCameraPos;
			Camera.transform.eulerAngles = BattleCameraRot;
			iTween.Stop(Camera.gameObject);
		});
	}

	public static VfxBase ShakeCompleteGameObject(GameObject obj, Vector3 position, Vector3 euler)
	{
		return InstantVfx.Create(delegate
		{
			obj.transform.localPosition = position;
			obj.transform.eulerAngles = euler;
			iTween.Stop(obj);
		});
	}

	public Camera Get3DCamera()
	{
		return Camera;
	}

	public void Dispose()
	{
		Camera = null;
	}
}
