2022-03-19 22:52:00 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class ConversationController : UnitySingleton<ConversationController>
|
|
|
|
|
{
|
|
|
|
|
private AConversation[] conversationList;
|
|
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
conversationList = FindObjectsOfType<AConversation>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnCall(string name)
|
|
|
|
|
{
|
|
|
|
|
//找到叫name的对话,并调用其OnCall()
|
|
|
|
|
foreach (AConversation conversation in conversationList)
|
|
|
|
|
{
|
|
|
|
|
if (conversation.conversationName == name)
|
|
|
|
|
{
|
2022-03-20 23:28:11 +08:00
|
|
|
|
Debug.Log("找到对话:" + name);
|
2022-03-19 22:52:00 +08:00
|
|
|
|
conversation.OnCall();
|
|
|
|
|
//改变玩家地图至Null
|
|
|
|
|
FindObjectOfType<Player>().ToMap("Null");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//如果没找到,则报错
|
|
|
|
|
Debug.LogError("没有找到名为" + name + "的对话");
|
|
|
|
|
}
|
2022-03-20 23:28:11 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 如果正在演出,是不可以还给玩家操作权限的,出此下策,记录此时是否在演出
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool CheckStage(){
|
|
|
|
|
Stage[] stageList = FindObjectsOfType<Stage>();
|
|
|
|
|
foreach (Stage stage in stageList)
|
|
|
|
|
{
|
|
|
|
|
if (stage.isPlaying)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2022-03-19 22:52:00 +08:00
|
|
|
|
}
|