99 lines
3.5 KiB
C#
99 lines
3.5 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
public class LiveSceneManager : SingletonMono<LiveSceneManager>
|
||
{
|
||
[HideInInspector]
|
||
public FirstPersonController firstPersonController;
|
||
[HideInInspector]
|
||
public GameObject currentTool;
|
||
public Transform spawnToolPos;
|
||
public Transform tMDTips;
|
||
public string triggerName;
|
||
|
||
protected override void Awake()
|
||
{
|
||
base.Awake();
|
||
firstPersonController = GameObject.FindGameObjectWithTag("Player").GetComponent<FirstPersonController>();
|
||
tMDTips.gameObject.SetActive(false);
|
||
}
|
||
public void SetSpawnToolInfo(GameObject tool)
|
||
{
|
||
currentTool = tool;
|
||
currentTool.transform.parent = Camera.main.transform;
|
||
currentTool.transform.localPosition = spawnToolPos.localPosition;
|
||
currentTool.transform.localEulerAngles = spawnToolPos.localEulerAngles;
|
||
if (currentTool.GetComponent<Tool_Base>())
|
||
{
|
||
currentTool.GetComponent<Tool_Base>().SetHeadPosAndEulerang(currentTool.transform.localPosition, currentTool.transform.localEulerAngles);
|
||
currentTool.GetComponent<Tool_Base>().AddStartAction(() =>
|
||
{
|
||
tMDTips.gameObject.SetActive(false);
|
||
});
|
||
currentTool.GetComponent<Tool_Base>().AddEndAction(() =>
|
||
{
|
||
tMDTips.gameObject.SetActive(true);
|
||
});
|
||
}
|
||
if (currentTool.GetComponent<Device_Base>())
|
||
{
|
||
currentTool.GetComponent<Device_Base>().SetHeadPosAndEulerang(currentTool.transform.localPosition, currentTool.transform.localEulerAngles);
|
||
currentTool.GetComponent<Device_Base>().AddStartAction(() =>
|
||
{
|
||
tMDTips.gameObject.SetActive(false);
|
||
});
|
||
currentTool.GetComponent<Device_Base>().AddEndAction(() =>
|
||
{
|
||
tMDTips.gameObject.SetActive(true);
|
||
});
|
||
}
|
||
tMDTips.gameObject.SetActive(true);
|
||
if (currentTool.name.Equals("<22><><EFBFBD><EFBFBD>֤"))
|
||
{
|
||
GameManager.UIMgr.ShowPanel<UI_PlayerSessionPanel>(E_UI_Layer.Mid, (p) =>
|
||
{
|
||
p.Init(currentTool.name, "<22><><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>xx<78><78><EFBFBD>繫˾Ա<CBBE><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵĹ<D2B5><C4B9><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Թ<D4B9><F3BBA7B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD><EFBFBD><EFBFBD>", (intTemp) =>
|
||
{
|
||
GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(intTemp, true);
|
||
ScoreManager.instance.Check(currentTool.name, null);
|
||
if (currentTool != null)
|
||
Destroy(currentTool);
|
||
});
|
||
});
|
||
tMDTips.gameObject.SetActive(false);
|
||
currentTool.transform.localEulerAngles = new Vector3(90, 0, 0);
|
||
|
||
}
|
||
if (currentTool.name.Equals("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5>ܱ<EFBFBD>"))
|
||
{
|
||
tMDTips.gameObject.SetActive(false);
|
||
currentTool.transform.localEulerAngles = new Vector3(-90, 0, -180);
|
||
}
|
||
}
|
||
|
||
private void Update()
|
||
{
|
||
if (Input.GetKeyDown(KeyCode.Escape))
|
||
{
|
||
if (currentTool != null)
|
||
{
|
||
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, true) == 0)
|
||
{
|
||
Debug.Log("Escape");
|
||
tMDTips.gameObject.SetActive(false);
|
||
Destroy(currentTool);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
public void OnCheckSubProcess(bool ifdestroy = true)
|
||
{
|
||
if (tMDTips != null)
|
||
tMDTips.gameObject.SetActive(false);
|
||
if (ifdestroy)
|
||
Destroy(currentTool);
|
||
}
|
||
}
|