49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using PhxhSDK;
|
|
using UnityEngine;
|
|
namespace Gameplay.Skill
|
|
{
|
|
public class SkillRotateCamera
|
|
{
|
|
public const string PREFAB_PATH = "Assets/Art/Other/skill_camera_rotate.prefab";
|
|
|
|
public GameObject rootObj;
|
|
|
|
private Camera _rawCamera;
|
|
|
|
public SkillRotateCamera()
|
|
{
|
|
var sampleObj = AssetManager.Instance.GetPreLoadResult<GameObject>(PREFAB_PATH);
|
|
if (sampleObj == null)
|
|
{
|
|
Debug.LogError("SkillRotateCamera sampleObj is null");
|
|
return;
|
|
}
|
|
rootObj = Object.Instantiate(sampleObj);
|
|
_rawCamera = rootObj.GetComponentInChildren<Camera>();
|
|
rootObj.SetActive(false);
|
|
}
|
|
|
|
|
|
public void Show()
|
|
{
|
|
var skillUnit = SkillManager.instance.inSkillingUnit;
|
|
if (skillUnit == null)
|
|
{
|
|
Debug.LogError("SkillRotateCamera Show skillUnit is null");
|
|
return;
|
|
}
|
|
var skillPos = skillUnit.transform.position;
|
|
var skillRot = skillUnit.transform.rotation;
|
|
rootObj.transform.position = skillPos;
|
|
rootObj.transform.rotation = skillRot;
|
|
rootObj.SetActive(true);
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
rootObj.SetActive(false);
|
|
}
|
|
|
|
}
|
|
}
|