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.

88 lines
2.3 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using DG.Tweening;
public class Canvas2 : MonoBehaviour
{
public AudioClip[] ac;
AudioSource audioSource;
public GameObject tip2;
public GameObject step2_1;
public GameObject step2_2;
public Animator animator;
public GameObject errorTip;
public GameObject step2_3;
private void Start()
{
audioSource = GetComponent<AudioSource>();
EventManager.Instance.register("NextAc", NextAc);
EventManager.Instance.register("ActionTwoEnd", ActionTwoEnd);
EventManager.Instance.register("guancha",Guancha);
tip2.SetActive(true);
Invoke("InitLevel2", 3);
}
void InitLevel2()
{
tip2.GetComponentInChildren<Tip>().str = "请选择正确的部位进行拍打询问";
tip2.SetActive(false);
step2_1.SetActive(true);
tip2.SetActive(true);
}
void Guancha(params object[] data) {
audioSource.clip = ac[1];
audioSource.Play();
}
public void ActionOne(bool inspect) {
if (inspect)
{
step2_1.SetActive(false);
audioSource.clip = ac[0];
audioSource.Play();
animator.SetTrigger("Huhuan");
}
else {
errorTip.SetActive(true);
errorTip.GetComponentInChildren<ErrorTip>().InitThis("当前拍打部位错误,请重试");
}
}
void NextAc(params object[] data) {
GameObject obj = Instantiate(Resources.Load<GameObject>("operate"), GameObject.FindWithTag("Grid").transform);
obj.GetComponent<Operate>().str = "1-判断被救者有无意识";
tip2.GetComponentInChildren<Tip>().str = "请选择正确的部位进行观察";
tip2.SetActive(false);
tip2.SetActive(true);
step2_2.SetActive(true);
}
void ActionTwoEnd(params object[] data) {
step2_3.SetActive(true);
}
public void ActionTwo(bool inspect)
{
if (inspect)
{
step2_2.SetActive(false);
animator.SetTrigger("Tuoyi");
}
else
{
errorTip.SetActive(true);
errorTip.GetComponentInChildren<ErrorTip>().InitThis("当前观察部位错误,请重试");
}
}
}