Advertisement
Guest User

Backtrack Script

a guest
Aug 11th, 2020
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using AC; //Import Adventure Creator Library
  5. using PixelCrushers.DialogueSystem; //Import DialogueSystem library
  6.  
  7. public class BacktrackScript : MonoBehaviour
  8. {
  9. private Camera currentCam;
  10. public _Camera GoBackTo;
  11. public bool isInConversation = false;
  12.  
  13. // Start is called before the first frame update
  14. void Update ()
  15. {
  16. isInConversation = GameObject.FindWithTag("DialogueManager").GetComponent<DialogueSystemController>().IsConversationActive; //Checks if DialogueSystem is active.
  17.  
  18. if (Input.GetButtonUp("InteractionB") && KickStarter.mainCamera.attachedCamera == GetComponent<_Camera>() && isInConversation == false)//If I Right-Click & I'm on the current camera, and Dialogue System is off...
  19. {
  20. AC.KickStarter.mainCamera.SetGameCamera(GoBackTo, 1.0f, MoveMethod.Smooth, null); //...Camera Switch to the defined GoBackTo Camera.
  21. Debug.Log("Going Back to: " + GoBackTo); //Report it in the console.
  22. }
  23. Debug.Log("Assigned Camera: " + KickStarter.mainCamera.attachedCamera); //Always report what camera we're on.
  24. }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement