Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using PixelCrushers.DialogueSystem;
- using com.ootii.Actors.AnimationControllers;
- public class OnTalking : MonoBehaviour
- {
- public GameObject pPlayer;
- public string conversationName;
- public int conversationID;
- private bool inputEnable = false;
- private MotionController mMotionController;
- // Use this for initialization
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- SetInput();
- CheckIsConversationActive();
- }
- void Reset()
- {
- pPlayer = null;
- conversationName = null;
- conversationID = 0;
- inputEnable = false;
- }
- void OnInteract()
- {
- DialogueManager.StartConversation(conversationName, pPlayer.transform, gameObject.transform, conversationID);
- }
- void SetInput()
- {
- mMotionController = pPlayer.GetComponent<MotionController>();
- if (mMotionController != null)
- {
- if (inputEnable)
- {
- mMotionController.InputSource.IsEnabled = false;
- }
- else
- {
- mMotionController.InputSource.IsEnabled = true;
- }
- }
- }
- void CheckIsConversationActive()
- {
- bool isConversationActive = DialogueManager.IsConversationActive;
- if (isConversationActive)
- {
- Debug.Log("Active");
- inputEnable = true;
- }
- else
- {
- Debug.Log("Inactive");
- inputEnable = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement