2021744738 2 years ago
commit 3aa3877aa1

@ -1,87 +0,0 @@
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("当前观察部位错误,请重试");
}
}
}

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e546a613bbac3ad44acb0fff81fb0b44
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -1,39 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class DrawLine : MonoBehaviour,IPointerClickHandler
{
RectTransform rt;
void Start()
{
rt = GetComponent<RectTransform>();
Vector2 point1 = rt.anchoredPosition + new Vector2(-rt.sizeDelta.x / 2, rt.sizeDelta.y / 2);
Vector2 point2 = rt.anchoredPosition + new Vector2(rt.sizeDelta.x / 2, rt.sizeDelta.y / 2);
Vector2 point3 = rt.anchoredPosition + new Vector2(-rt.sizeDelta.x / 2, -rt.sizeDelta.y / 2);
Vector2 point4 = rt.anchoredPosition + new Vector2(rt.sizeDelta.x / 2, -rt.sizeDelta.y / 2);
DrawStraightLine(point1, point2);
DrawStraightLine(point2, point4);
DrawStraightLine(point3, point4);
DrawStraightLine(point3, point1);
}
void DrawStraightLine(Vector2 a, Vector2 b)
{
GameObject img = new GameObject();
img.AddComponent<Image>();
img.transform.SetParent(transform);
img.GetComponent<Image>().raycastTarget = false;
float distance = Vector2.Distance(a, b);
float angle = Vector2.SignedAngle(a - b, Vector2.left);
img.GetComponent<RectTransform>().anchoredPosition = (a + b) / 2;
img.GetComponent<RectTransform>().sizeDelta = new Vector2(distance, 5);
img.transform.localRotation = Quaternion.AngleAxis(-angle, Vector3.forward);
img.GetComponent<Image>().color = Color.red;
}
public void OnPointerClick(PointerEventData eventData)
{
}
}

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7f500fe94495be2459997134376a881e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -1,28 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Question2 : MonoBehaviour
{
public int index;//玩家选择的答案记录
int rand;//随机的结果
public string[] questionInfo;
Toggle tg;
void Start()
{
tg = GetComponent<Toggle>();
Debug.Log("对题目进行初始化");
rand = Step2_3.rand;
transform.GetChild(1).GetComponent<Text>().text = questionInfo[rand];
tg.onValueChanged.AddListener((bool value) =>
{
if (value)
{
EventManager.Instance.emit("Question2", index);
}
});
}
}

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: fd91c0d5a804bf64498ad6c20b35d0fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -1,21 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using UnityEngine.UI;
public class Tip : MonoBehaviour
{
public float time;
[TextArea]
public string str;
Text myText;
private void Awake()
{
myText = GetComponent<Text>();
}
private void OnEnable()
{
myText.text = "";
myText.DOText(str, time);
}
}

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4cb08099ae8f90d4890c0319edd1e963
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -1,9 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Const:MonoBehaviour
{
}

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 2cb7a923ce234c242a10dd106105826f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -1,104 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
using UnityEngine.UI;
public class GameManager : MonoSingleton<GameManager>
{
public GameObject GameEndTip;
public GameObject greenPerson;
public GameObject person2;
public GameObject[] needRemoveObjs;
public GameObject[] needTransferObjs;
public GameObject errorTip;
public GameObject clickTip;
bool safe=false;
public bool remove=false;
public int safeOperate;//玩家选择的对应操作0对应转移1对应清理
RaycastHit rh;
protected override void Awake()
{
base.Awake();
DontDestroyOnLoad(gameObject);
//safe = Random.Range(0,1f) > 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);
clickTip.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);
greenPerson.GetComponent<GreenMan>().SetPosBySafe(true);
FindObjectOfType<CinemachineFreeLook>().LookAt = needTransferObjs[0].transform;
FindObjectOfType<CinemachineFreeLook>().Follow = needTransferObjs[0].transform;
FindObjectOfType<CinemachineFreeLook>().m_YAxis.Value = 0.75f;
FindObjectOfType<CinemachineFreeLook>().m_XAxis.Value = 56.27f;
foreach (GameObject obj in needTransferObjs)
{
obj.transform.position += new Vector3(2, 0, -35);
}
GameObject obj2 = Instantiate(Resources.Load<GameObject>("operate"));
obj2.GetComponent<Operate>().str = "2-将被救者转移到安全位置";
Invoke("ZhuanyiEnd",2);
}
void ZhuanyiEnd() {
errorTip.SetActive(true);
errorTip.GetComponentInChildren<ErrorTip>().InitThis("恭喜通关", 60);
GameEndTip.SetActive(true);
GameEndTip.GetComponentInChildren<Text>().text="已成功转移到安全位置";
EduCoderTool.WebConnecter.Singleton.SendResultToWeb(true);
}
}

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: fc62637c6246ccc428064df41cb5be1d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -1,11 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LoadManager : MonoSingleton<LoadManager>
{
public T Load<T>(string path) where T:class
{
return Resources.Load(path) as T;
}
}

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c94f25fee4a4da34bbe263f631e5cd65
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 0f0567f363b89b847b07c63968cf7b33
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -1,3 +0,0 @@
public interface IObserver {
void Notify();
}

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 46ec0ffc8508fa24aa92cddc19d59dcc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -1,39 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class MessageCenter : MonoSingleton<MessageCenter>
{
public delegate void Message();
Dictionary<string, Message> Events=new Dictionary<string, Message>();
protected override void Awake()
{
base.Awake();
DontDestroyOnLoad(gameObject);
Events = new Dictionary<string, Message>();
}
public void AddListen(string eventName, IObserver observer) {
if (!Events.ContainsKey(eventName))
{
Message message = new Message(observer.Notify);
Events.Add(eventName, message);
return;
}
Events[eventName]+=observer.Notify;
}
public void RemoveListen(string eventName, IObserver observer)
{
if (Events.ContainsKey(eventName))
{
Events[eventName] -= observer.Notify;
}
}
public void SendEvent(string eventName) {
if (!Events.ContainsKey(eventName)) return;
Events[eventName]();
}
}

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e86b7a137f0e0fe4baf15cad99c6bcff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save