當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。