Advertisement
LukeWhite_Work

Safe Handle

Feb 6th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class SafeHandle : MonoBehaviour {
  6.  
  7.     public bool GOGOGO = false;
  8.     private bool OverrideSafe = false;
  9.     private Safe_Script SafeRef;
  10.     private float LerpSpeed = 2.5f;
  11.     private float LerpJuice = 0f;
  12.     StoryController storymanager;
  13.  
  14.  
  15.     void Start () {
  16.         SafeRef = GameObject.Find("SafeDial").GetComponent<Safe_Script>();
  17.         storymanager = GameObject.Find ("StoryManager").GetComponent<StoryController> ();
  18.     }
  19.    
  20.     void Update () {
  21.         if (GOGOGO == false) {
  22.             if(SafeRef.EYYSafeIsNowUnlocked || OverrideSafe)
  23.             {
  24.                 transform.localRotation = Quaternion.Lerp(Quaternion.Euler(0f, 0f, 0f), Quaternion.Euler(0f, 40f, 0f), LerpJuice);
  25.                
  26.                 if (LerpJuice < 1)
  27.                 {
  28.                     LerpJuice = LerpJuice + (LerpSpeed * Time.deltaTime);
  29.                 }
  30.                 else
  31.                 {
  32.                     GOGOGO = true;
  33.                     storymanager.incrementStage ();
  34.                 }
  35.             }
  36.             if(Input.GetKeyDown(KeyCode.Alpha6))
  37.             {
  38.                 OverrideSafe = true;
  39.             }
  40.  
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement