using System.Collections; using System.Collections.Generic; using UnityEngine; using Fungus; using UnityEngine.InputSystem; public class Chasing : Event { //控制追逐战触发的事件代码 // Start is called before the first frame update private bool hasBeenCalled = false; [Tooltip("拖入直升机灯光游戏物体")] public GameObject helicopter; [Tooltip("拖入追逐战BGM")] public AudioClip clip; void Start() { } // Update is called once per frame void Update() { } public void OnTriggerEnter2D(Collider2D other) { if(other.tag == "Player" && !hasBeenCalled) { // Debug.Log("开始追逐战"); //标记自身已被唤醒过 hasBeenCalled = true; //打开直升机灯光 helicopter.SetActive(true); //关闭玩家操作地图(在对话结束后自动恢复) FindObjectOfType().SwitchCurrentActionMap("NullMap"); //弹出对话【是直升机】 Flowchart.BroadcastFungusMessage("是直升机"); //更换BGM FindObjectOfType().ChangedTheBGM(clip); } } public void OnDialogEnd() { //对话结束后调用:直升机灯光开始运动 // Debug.Log("直升机开始移动"); helicopter.GetComponent().canGo = true; //22秒后,直升机差不多完全离开了,弹出对话引导玩家在桌边修理电报机 Invoke("TalkAboutRepare",22f); } private void TalkAboutRepare() { //弹出对话 Flowchart.BroadcastFungusMessage("飞机走了"); //清除操作地图 FindObjectOfType().SwitchCurrentActionMap("NullMap"); //找到修理台,开启它的碰撞盒 FindObjectOfType().GetComponent().enabled = true; } }