上海虹口龙之梦项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
813 B

using System;
using UnityEngine;
[RequireComponent(typeof(CarController))]
public class CarUserControl : MonoBehaviour
{
private CarController m_Car; // the car controller we want to use
public FiremanControl firemanControl;
private void Awake()
{
// get the car controller
m_Car = GetComponent<CarController>();
}
private void FixedUpdate()
{
if ((firemanControl.driving) && (firemanControl.currCar == this.gameObject))
{
// pass the input to the car!
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
float handbrake = Input.GetAxis("Jump");
m_Car.Move(h, v, v, handbrake);
}
else
{
m_Car.Move(0, 0, 0, 1);
}
}
}