31 lines
843 B
C#
31 lines
843 B
C#
![]() |
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)
|
|||
|
{
|
|||
|
conversation.OnCall();
|
|||
|
//改变玩家地图至Null
|
|||
|
FindObjectOfType<Player>().ToMap("Null");
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
//如果没找到,则报错
|
|||
|
Debug.LogError("没有找到名为" + name + "的对话");
|
|||
|
}
|
|||
|
}
|