Advertisement
nikorenos

Untitled

Jan 17th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GetOutOurCar : MonoBehaviour {    
  6.    
  7.     public GameObject WheelCamera;
  8.     public GameObject BrakeMe;
  9.     public GameObject driver;
  10.     public GameObject OurCar;
  11.     public GameObject DoorAnimation;    
  12.    
  13.     private bool activate;      
  14.  
  15.     Animator animator;
  16.    
  17.     void Start ()
  18.     {      
  19.         animator = WheelCamera.GetComponent<Animator> ();      
  20.     }
  21.    
  22.    
  23.     void OnTriggerEnter(Collider other)
  24.     {
  25.         if (!activate) //&& (other.tag == "Player")
  26.         {
  27.            
  28.             BrakeMe.SetActive(false);            
  29.             driver.SetActive(false);
  30.             OurCar.GetComponent<RCC_AICarController>().enabled = false;
  31.             OurCar.GetComponent<Rigidbody>().useGravity = false;
  32.             OurCar.GetComponent<Rigidbody>().isKinematic = true;
  33.             WheelCameraGetOutController("GetOut");
  34.             DoorAnimation.GetComponent<Animator>().enabled = true;                        
  35.             activate = true;
  36.         }
  37.        
  38.     }
  39.     void WheelCameraGetOutController(string direction) //Animator function.
  40.     {
  41.         animator.SetTrigger(direction);
  42.     }  
  43.    
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement