本文整理汇总了C#中CarController类的典型用法代码示例。如果您正苦于以下问题:C# CarController类的具体用法?C# CarController怎么用?C# CarController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CarController类属于命名空间,在下文中一共展示了CarController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckpointTriggered
public void CheckpointTriggered(CarController car, int checkPointIndex)
{
PositionData carData = _carPositions[car];
if (!_finished)
{
if (checkPointIndex == 0)
{
if (carData.checkPoint == checkpointcount-1)
{
carData.checkPoint = checkPointIndex;
carData.lap += 1;
Debug.Log(car.name + " lap " + carData.lap);
if (IsPlayer(car))
{
GetComponent<RaceManager>().Announce("Tour " + (carData.lap+1).ToString());
}
if (carData.lap >= _totalLaps)
{
_finished = true;
GetComponent<RaceManager>().EndRace(car.name.ToLower());
}
}
}
else if (carData.checkPoint == checkPointIndex-1) //Checkpoints must be hit in order
{
carData.checkPoint = checkPointIndex;
}
}
}
示例2: Start
void Start()
{
engineSource = GetComponents<AudioSource>()[0];
skidSource = GetComponents<AudioSource>()[1];
car = GetComponent (typeof (CarController)) as CarController;
drivetrain = GetComponent (typeof (Drivetrain)) as Drivetrain;
}
示例3: Awake
void Awake()
{
// get the car controller
renderer.enabled = false;
car = transform.parent.gameObject.GetComponent<CarController>();
rigidbody.position = car.rigidbody.position + Vector3.up * 5;
}
示例4: Index_GetCar
public void Index_GetCar()
{
var expectedResult = new[]
{
new CarModel
{
CarId = 1,
Name = "Foo",
Color = "FooColor",
Price = 11111,
InventoryCount = 1,
Manufacturer = new ManufacturerModel
{
ManufacturerId = 1,
Country = "FooCountry",
Name = "FooManu"
}
}
};
var mockService = new Mock<ICarService>(MockBehavior.Strict);
mockService.Setup(s => s.GetCar(expectedResult[0].CarId)).Returns(expectedResult[0]);
var mockMapper = new Mock<Mappers.IMapper>(MockBehavior.Strict);
mockMapper.Setup(m => m.Map(expectedResult, typeof(IEnumerable<CarModel>), typeof(IEnumerable<CarViewModel>)));
var controller = new CarController(mockService.Object, mockMapper.Object);
var result = controller.Index(false, expectedResult[0].CarId) as ViewResult;
var model = result.Model as CarModel[];
Assert.IsNotNull(model);
mockService.Verify(foo => foo.GetCar(expectedResult[0].CarId));
}
示例5: RealCar
public RealCar(CarController parent)
{
Controller = parent;
CarInfo = new CarInformations();
IsAlertBrakeActive = false;
//regulators and communicator initiation
CarComunicator = new RealCarCommunicator(this); // = new RealCarCommunicator(this);
SpeedRegulator = new PIDSpeedRegulator(this);
//SpeedRegulator = new FakeSpeedRegulator();
//SteeringWheelAngleRegulator = new SimpleSteeringWheelRegulator(this);
SteeringWheelAngleRegulator = new PIDSteeringWheelAngleRegulator(this);
//SteeringWheelAngleRegulator = new FakeSteeringWheelRegulator();
BrakeRegulator = new PIDBrakeRegulator(this);
CarComunicator.InitRegulatorsEventsHandling(); //TODO: REFACTOR THIS SHIT!!! //for now this is needed, because reagulators does not exists when communicator constructor is invoked
//internal event handling initialization
evAlertBrake += new EventHandler(ExampleFakeCar_evAlertBrake);
evTargetSpeedChanged += new TargetSpeedChangedEventHandler(ExampleFakeCar_evTargetSpeedChanged);
evTargetSteeringWheelAngleChanged += new TargetSteeringWheelAngleChangedEventHandler(ExampleFakeCar_evTargetSteeringWheelAngleChanged);
}
示例6: Start
void Start()
{
car = GetComponent<CarController>();
transform.position = CurveFollower.transform.position;
transform.rotation = CurveFollower.transform.rotation;
CurveFollower.Speed = 0f;
}
示例7: Awake
// ==========================================
// == Awake
// ==========================================
void Awake()
{
// get the car controller
car = GetComponent<CarController>();
styleManager = GetComponent<StyleManager>();
}
示例8: Init
void Init()
{
_Sphere = GetComponent<SphereCollider>();
_ShootingScript = GetComponent<ShootScript>();
if (this.CompareTag("PlayerLogic"))
{
_PlayerCar = CarUserControl.Instance.m_Car;
}
else
{
_PlayerCar = GetComponent<CarController>();
}
if (_Weapons.Length != 0)
{
for (int i = 0; i < _Weapons.Length; i++)
{
_Weapons[i]._HitBox = _Weapons[i]._WeaponCollider.GetComponent<HitBox>();
_Weapons[i]._Tower._HitBox = _Weapons[i]._Tower._TowerCollider.GetComponent<HitBox>();
_Weapons[i]._WeaponTransform = transform.SearchChildWithName(_Weapons[i]._Name);
_Weapons[i]._Tower._TowerTransform = transform.SearchChildWithName(_Weapons[i]._Tower._Name);
}
}
_ShootingScript.Init();
}
示例9: Awake
void Awake()
{
_CarInfo = transform.root.GetComponent<CarInfo>();
_Car = transform.root.GetComponent<CarController>();
_Collider = GetComponent<Collider>();
Counting();
}
示例10: Start
void Start()
{
mTransform = transform;
position = mTransform.position;
rotation = mTransform.eulerAngles;
car = CarController.instance;
}
示例11: OnEnable
// Use this for initialization
void OnEnable()
{
previousGear = 1;
if(carController == null)
carController = transform.root.GetComponent<CarController>();
carController.gearShiftEvent += OnGearShift;
}
示例12: SetCar
public void SetCar(GameObject Car)
{
print("setcar "+Car);
CurrentCar = Car;
CC = Car.GetComponent<CarController>();
CarPos = Car.transform.position;
}
示例13: IsPlayer
bool IsPlayer(CarController car)
{
if (car == null)
return false;
return car.GetComponent<CarUserControlMP>() != null;
}
示例14: Start
void Start()
{
engineSource = CreateAudioSource(engine);
skidSource = CreateAudioSource(skid);
car = GetComponent (typeof (CarController)) as CarController;
drivetrain = GetComponent (typeof (Drivetrain)) as Drivetrain;
}
示例15: Awake
private void Awake()
{
// get the car controller
m_Car = GetComponent<CarController>();
screenWidth = Screen.width;
m_Rigidbody = GetComponent<Rigidbody>();
}