Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Jun 21st, 2018 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Playables;
  5.  
  6. public class SpaceshipCutscene : MonoBehaviour
  7. {
  8.     public Transform player;
  9.     public Transform npc;
  10.     public Camera FPSCamera;
  11.     public Camera mainCamera;
  12.     public Animator anim;
  13.     public float rotationSpeed = 3f;
  14.  
  15.     private bool moveNpc = false;
  16.  
  17.     // Use this for initialization
  18.     void Start()
  19.     {
  20.  
  21.     }
  22.  
  23.     private void Update()
  24.     {
  25.         if (moveNpc)
  26.         {
  27.           Vector3 dir = player.position - npc.position;
  28.         dir.y = 0; // keep the direction strictly horizontal
  29.         Quaternion rot = Quaternion.LookRotation(dir);
  30.         // slerp to the desired rotation over time
  31.         npc.rotation = Quaternion.Slerp(npc.rotation, rot, rotationSpeed * Time.deltaTime);
  32.         }
  33.     }
  34.  
  35.     private void OnTriggerExit(Collider other)
  36.     {
  37.         if (other.gameObject.name == "Horizontal_Doors_Kit")
  38.         {
  39.             FPSCamera.enabled = false;
  40.             mainCamera.enabled = true;
  41.             moveNpc = true;
  42.             anim.SetTrigger("SoldierAimingTrigger");
  43.         }
  44.     }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top