当前位置: 首页>>代码示例>>C#>>正文


C# CarController类代码示例

本文整理汇总了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;
            }
        }
    }
开发者ID:GuillaumeLangis,项目名称:LOG4715,代码行数:31,代码来源:CheckpointManager.cs

示例2: Start

 void Start()
 {
     engineSource = GetComponents<AudioSource>()[0];
     skidSource = GetComponents<AudioSource>()[1];
     car = GetComponent (typeof (CarController)) as CarController;
     drivetrain = GetComponent (typeof (Drivetrain)) as Drivetrain;
 }
开发者ID:sharifshahnewaz,项目名称:Cybersickness-Car,代码行数:7,代码来源:SoundController.cs

示例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;
 }
开发者ID:jhuel,项目名称:log4715,代码行数:7,代码来源:ArrowDirection.cs

示例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));
        }
开发者ID:nostlie,项目名称:Sandbox,代码行数:32,代码来源:HomeControllerTest.cs

示例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);
        }
开发者ID:Spawek,项目名称:autonomiczny_samochod,代码行数:26,代码来源:RealCar.cs

示例6: Start

 void Start()
 {
     car = GetComponent<CarController>();
     transform.position = CurveFollower.transform.position;
     transform.rotation = CurveFollower.transform.rotation;
     CurveFollower.Speed = 0f;
 }
开发者ID:Morac,项目名称:CarThing,代码行数:7,代码来源:ControlledCar.cs

示例7: Awake

    // ==========================================
    // == Awake
    // ==========================================
    void Awake()
    {
        // get the car controller
        car = GetComponent<CarController>();

        styleManager = GetComponent<StyleManager>();
    }
开发者ID:SeevenDev,项目名称:LOG4715_Lab2,代码行数:10,代码来源:CarUserControlMP.cs

示例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();
    }
开发者ID:napTu3aH,项目名称:Racing,代码行数:26,代码来源:WeaponRotate.cs

示例9: Awake

 void Awake()
 {
     _CarInfo = transform.root.GetComponent<CarInfo>();
     _Car = transform.root.GetComponent<CarController>();
     _Collider = GetComponent<Collider>();
     Counting();
 }
开发者ID:napTu3aH,项目名称:Racing,代码行数:7,代码来源:HitBox.cs

示例10: Start

 void Start()
 {
     mTransform = transform;
     position = mTransform.position;
     rotation = mTransform.eulerAngles;
     car = CarController.instance;
 }
开发者ID:whl33886,项目名称:GravityCar,代码行数:7,代码来源:CameraController.cs

示例11: OnEnable

 // Use this for initialization
 void OnEnable()
 {
     previousGear = 1;
     if(carController == null)
         carController = transform.root.GetComponent<CarController>();
     carController.gearShiftEvent += OnGearShift;
 }
开发者ID:Rarau,项目名称:racing_game,代码行数:8,代码来源:ExhaustFX.cs

示例12: SetCar

 public void SetCar(GameObject Car)
 {
     print("setcar "+Car);
     CurrentCar = Car;
     CC = Car.GetComponent<CarController>();
     CarPos = Car.transform.position;
 }
开发者ID:tegleg,项目名称:ucg,代码行数:7,代码来源:InputHandler.cs

示例13: IsPlayer

    bool IsPlayer(CarController car)
    {
        if (car == null)
            return false;

        return car.GetComponent<CarUserControlMP>() != null;
    }
开发者ID:Feinte75,项目名称:TP2_LOG4715,代码行数:7,代码来源:Accelerator.cs

示例14: Start

 void Start()
 {
     engineSource = CreateAudioSource(engine);
     skidSource = CreateAudioSource(skid);
     car = GetComponent (typeof (CarController)) as CarController;
     drivetrain = GetComponent (typeof (Drivetrain)) as Drivetrain;
 }
开发者ID:jsmulikow664,项目名称:Zombie-Slaughter-FPS,代码行数:7,代码来源:SoundController.cs

示例15: Awake

 private void Awake()
 {
     // get the car controller
     m_Car = GetComponent<CarController>();
     screenWidth = Screen.width;
     m_Rigidbody = GetComponent<Rigidbody>();
 }
开发者ID:Nunsense,项目名称:DeliveryBoy,代码行数:7,代码来源:PlayerController.cs


注:本文中的CarController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。