33 lines
925 B
C#
33 lines
925 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Trigger_Car : MonoBehaviour
|
|
{
|
|
public static bool istrue = false;
|
|
bool isFFirstTime = true;
|
|
public GameObject car;
|
|
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (istrue == false)
|
|
{
|
|
istrue = true;
|
|
car.GetComponent<UnityStandardAssets.Vehicles.Car.CarUserControl>().enabled = false;
|
|
car.GetComponent<Rigidbody>().isKinematic = true;
|
|
car.GetComponent<Rigidbody>().detectCollisions = true;
|
|
if (!isFFirstTime)
|
|
{
|
|
car.GetComponent<Animator>().SetTrigger("isTrigger");
|
|
}
|
|
else
|
|
{
|
|
isFFirstTime = false;
|
|
}
|
|
car.GetComponent<Animator>().enabled = true;
|
|
transform.GetChild(0).gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|