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