|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Cinemachine;
|
|
|
|
|
public class GameManager : MonoSingleton<GameManager>
|
|
|
|
|
{
|
|
|
|
|
public GameObject greenPerson;
|
|
|
|
|
public GameObject person2;
|
|
|
|
|
public GameObject[] needRemoveObjs;
|
|
|
|
|
public GameObject[] needTransferObjs;
|
|
|
|
|
public GameObject errorTip;
|
|
|
|
|
bool safe;
|
|
|
|
|
public bool remove=false;
|
|
|
|
|
public int safeOperate;//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ķ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>Ӧת<D3A6>ƣ<EFBFBD>1<EFBFBD><31>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|
|
|
|
RaycastHit rh;
|
|
|
|
|
protected override void Awake()
|
|
|
|
|
{
|
|
|
|
|
base.Awake();
|
|
|
|
|
DontDestroyOnLoad(gameObject);
|
|
|
|
|
safe = Random.value > 0.5 ? true : false;
|
|
|
|
|
InitScene(safe);
|
|
|
|
|
}
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
if (remove) {
|
|
|
|
|
Ray ray=Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
|
|
|
if (Physics.Raycast(ray, out rh)) {
|
|
|
|
|
if (rh.collider.tag == "ZAW" && Input.GetMouseButtonDown(0)) {
|
|
|
|
|
if (rh.collider.GetComponent<Animator>())
|
|
|
|
|
{
|
|
|
|
|
rh.collider.GetComponent<Animator>().SetTrigger("Sankai");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
rh.collider.gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
rh.collider.tag = "Untagged";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void InitScene(bool safe) {
|
|
|
|
|
greenPerson.GetComponent<GreenMan>().SetPosBySafe(safe);
|
|
|
|
|
if (!safe)
|
|
|
|
|
{
|
|
|
|
|
foreach (GameObject obj in needRemoveObjs)
|
|
|
|
|
{
|
|
|
|
|
obj.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
greenPerson.tag = "ZAW";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PanDuanSafe(bool safe) {
|
|
|
|
|
EventManager.Instance.emit("PanDuanSafe", this.safe == safe,this.safe);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetSafeOperate(int index) {
|
|
|
|
|
safeOperate = index;
|
|
|
|
|
if (index == 0) {
|
|
|
|
|
EventManager.Instance.emit("SafeOperate",0);
|
|
|
|
|
Invoke("TransferObjs", 1);
|
|
|
|
|
} else if (index==1) {
|
|
|
|
|
greenPerson.tag = "ZAW";
|
|
|
|
|
remove = true;
|
|
|
|
|
EventManager.Instance.emit("SafeOperate",1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TransferObjs() {
|
|
|
|
|
person2.SetActive(true);
|
|
|
|
|
FindObjectOfType<CinemachineFreeLook>().LookAt = needTransferObjs[0].transform;
|
|
|
|
|
FindObjectOfType<CinemachineFreeLook>().Follow = needTransferObjs[0].transform;
|
|
|
|
|
foreach (GameObject obj in needTransferObjs)
|
|
|
|
|
{
|
|
|
|
|
obj.transform.position += new Vector3(2, 0, -40);
|
|
|
|
|
}
|
|
|
|
|
GameObject obj2 = Instantiate(Resources.Load<GameObject>("operate"));
|
|
|
|
|
obj2.GetComponent<Operate>().str = "2-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>ȫλ<C8AB><CEBB>";
|
|
|
|
|
errorTip.SetActive(true);
|
|
|
|
|
errorTip.GetComponentInChildren<ErrorTip>().InitThis("<22><>ϲͨ<CFB2><CDA8>",60);
|
|
|
|
|
EduCoderTool.WebConnecter.Singleton.SendResultToWeb(true);
|
|
|
|
|
}
|
|
|
|
|
}
|