Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- public class MessagingClientReceiver : MonoBehaviour {
- // Use this for initialization
- void Start()
- {
- //Debug.Log ("Starting Messaging Client Receiver");
- MessagingManager.Instance.Subscribe(ThePlayerIsTryingToLeave);
- //Debug.Log ("Ending Messaging Client Receiver");
- }
- void ThePlayerIsTryingToLeave()
- {
- //Debug.Log ("Starting getting Conversation Component");
- var dialog = GetComponent<ConversationComponent>();
- if (dialog != null)
- {
- if (dialog.Conversations != null && dialog.Conversations.Length > 0)
- {
- var conversation = dialog.Conversations[0];
- if (conversation != null)
- {
- ConversationManager.Instance.StartConversation(conversation);
- }
- }
- }
- //Debug.Log ("Ending getting Conversation Component");
- }
- void OnDestroy()
- {
- if (MessagingManager.Instance != null)
- {
- MessagingManager.Instance.UnSubscribe(ThePlayerIsTryingToLeave);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement