Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class GreandalMessagingReceiver : MonoBehaviour {
- void Start()
- {
- MessagingManager.Instance.GreandalSubscribe(GreandalConversations);
- }
- void GreandalConversations()
- {
- Debug.Log("Starting conversation");
- var dialog = GetComponent<ConversationComponent>();
- if (dialog != null)
- {
- if (dialog.Conversations != null && dialog.Conversations.Length > 0)
- {
- var conversation = dialog.Conversations[0];
- if (conversation != null && !conversation.Complete)
- {
- ConversationManager.Instance.StartConversation(conversation);
- }
- else
- {
- Debug.Log("No active conversation found");
- }
- }
- else
- {
- Debug.Log("No conversation found");
- }
- }
- }
- void OnDestroy()
- {
- if (MessagingManager.Instance != null)
- {
- MessagingManager.Instance.GreandalUnSubscribe(GreandalConversations);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement