You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.2 KiB
82 lines
2.2 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
public class Step2_3 : MonoBehaviour
|
|
{
|
|
public Animator greenMan;
|
|
public Text State;
|
|
public static int rand;
|
|
int answer=-1;
|
|
public GameObject errorTip;
|
|
public GameObject tip;
|
|
|
|
private void Awake()
|
|
{
|
|
EventManager.Instance.register("Question2", Question2);
|
|
}
|
|
private void OnEnable()
|
|
{
|
|
Obstacle();
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
GameObject obj = Instantiate(Resources.Load<GameObject>("operate"), GameObject.FindWithTag("Grid").transform);
|
|
obj.GetComponent<Operate>().str = "2-观察被救者部位";
|
|
}
|
|
|
|
void Obstacle()
|
|
{
|
|
Debug.Log("随机结果");
|
|
rand = 10;
|
|
rand = Random.RandomRange(0, 2);
|
|
if (rand == 0)
|
|
{
|
|
State.text = "正常";
|
|
}
|
|
else if (rand == 1)
|
|
{
|
|
State.text = "不正常";
|
|
|
|
}
|
|
}
|
|
|
|
public void Question2(params object[] data) {
|
|
answer = (int)data[0];
|
|
}
|
|
|
|
public void PanDuan() {
|
|
if (rand == 0)
|
|
{
|
|
if (answer == 2)
|
|
{
|
|
greenMan.SetTrigger("Call");
|
|
GameObject obj = Instantiate(Resources.Load<GameObject>("operate"), GameObject.FindWithTag("Grid").transform);
|
|
obj.GetComponent<Operate>().str = "3-请人拨打120";
|
|
tip.SetActive(false);
|
|
gameObject.SetActive(false);
|
|
}
|
|
else {
|
|
errorTip.SetActive(true);
|
|
errorTip.GetComponentInChildren<ErrorTip>().InitThis("答案选择错误,请重试");
|
|
}
|
|
}
|
|
else if (rand == 1)
|
|
{
|
|
if (answer == 2)
|
|
{
|
|
greenMan.SetTrigger("Call");
|
|
GameObject obj = Instantiate(Resources.Load<GameObject>("operate"), GameObject.FindWithTag("Grid").transform);
|
|
obj.GetComponent<Operate>().str = "3-请人拨打120以及拿取AED";
|
|
tip.SetActive(false);
|
|
gameObject.SetActive(false);
|
|
}
|
|
else {
|
|
errorTip.SetActive(true);
|
|
errorTip.GetComponentInChildren<ErrorTip>().InitThis("答案选择错误,请重试");
|
|
}
|
|
}
|
|
}
|
|
}
|