79 lines
2.4 KiB
C#
79 lines
2.4 KiB
C#
using DG.Tweening;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
[AddComponentMenu("PatternChoose/模式选择")]
|
|
public class PatternChoose : MonoBehaviour
|
|
{
|
|
static PatternChoose _inst;
|
|
public static PatternChoose Inst => _inst;
|
|
public Button TS_button;
|
|
public Button RL_button;
|
|
/// <summary>
|
|
/// 热力效果图
|
|
/// </summary>
|
|
public GameObject heatMap;
|
|
// Start is called before the first frame update
|
|
|
|
Vector3 init_pos;
|
|
Vector3 init_rot;
|
|
|
|
[SerializeField] public Color red_alarm;
|
|
[SerializeField] public Color yellow_alarm;
|
|
[SerializeField] public Color blue_alarm;
|
|
private void Awake()
|
|
{
|
|
if (_inst != null && _inst != this)
|
|
{
|
|
Destroy(this.gameObject);
|
|
}
|
|
else
|
|
{
|
|
_inst = this;
|
|
DontDestroyOnLoad(this.gameObject);
|
|
}
|
|
init_pos = Camera.main.transform.localPosition;
|
|
init_rot = Camera.main.transform.localEulerAngles;
|
|
}
|
|
void Start()
|
|
{
|
|
TS_button.onClick.AddListener(() => F1(false));
|
|
RL_button.onClick.AddListener(() => F2(true));
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void F1(bool isheatMap)
|
|
{
|
|
heatMap.SetActive(isheatMap);
|
|
ExtendedFlycam.Inst.init_mainCamera_rot();
|
|
Camera.main.transform.DOMove(/*TransparentGlowManage.Inst.MainCamera_pos*/init_pos, 1f);
|
|
Camera.main.transform.DORotateQuaternion(Quaternion.Euler(/*TransparentGlowManage.Inst.MainCamera_rot*/init_rot), 1f).OnComplete(() =>
|
|
{
|
|
//更新相机初始旋转角度
|
|
ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
|
|
});
|
|
TransparentGlowManage.Inst.renewALL();
|
|
}
|
|
|
|
void F2(bool isheatMap)
|
|
{
|
|
heatMap.SetActive(isheatMap);
|
|
ExtendedFlycam.Inst.init_mainCamera_rot();
|
|
Camera.main.transform.DOMove(/*TransparentGlowManage.Inst.MainCamera_pos*/init_pos, 1f);
|
|
Camera.main.transform.DORotateQuaternion(Quaternion.Euler(/*TransparentGlowManage.Inst.MainCamera_rot*/init_rot), 1f).OnComplete(() =>
|
|
{
|
|
//更新相机初始旋转角度
|
|
ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
|
|
});
|
|
TransparentGlowManage.Inst.renewALL();
|
|
}
|
|
}
|