Example #1
0
        public void SpawnVehicle(int vehicle)
        {
            this.newVehicle = Instantiate(this.vehicles[vehicle],
                                          this.spawnPoint,
                                          Quaternion.LookRotation(this.spawnRot, GlobalControl.worldUpDir));
            this.cam.target = this.newVehicle.transform;
            this.cam.Initialize();
            this.vp = this.newVehicle.GetComponent <VehicleParent>();

            this.trans = this.newVehicle.GetComponentInChildren <Transmission>();
            if (this.trans)
            {
                this.trans.automatic = this.autoShift;
                this.newVehicle.GetComponent <VehicleParent>().brakeIsReverse = this.autoShift;

                if (this.trans is GearboxTransmission)
                {
                    this.gearbox = this.trans as GearboxTransmission;
                }
                else if (this.trans is ContinuousTransmission)
                {
                    this.varTrans = this.trans as ContinuousTransmission;

                    if (!this.autoShift)
                    {
                        this.vp.brakeIsReverse = true;
                    }
                }
            }

            if (this.newVehicle.GetComponent <VehicleAssist>())
            {
                this.newVehicle.GetComponent <VehicleAssist>().enabled = this.assist;
            }

            if (this.newVehicle.GetComponent <FlipControl>() && this.newVehicle.GetComponent <StuntDetect>())
            {
                this.newVehicle.GetComponent <FlipControl>().flipPower =
                    this.stuntMode && this.assist ? new Vector3(10, 10, -10) : Vector3.zero;
                this.newVehicle.GetComponent <FlipControl>().rotationCorrection =
                    this.stuntMode ? Vector3.zero : (this.assist ? new Vector3(5, 1, 10) : Vector3.zero);
                this.newVehicle.GetComponent <FlipControl>().stopFlip = this.assist;
                this.stunter = this.newVehicle.GetComponent <StuntDetect>();
            }

            this.engine         = this.newVehicle.GetComponentInChildren <Motor>();
            this.propertySetter = this.newVehicle.GetComponent <PropertyToggleSetter>();

            this.stuntText.gameObject.SetActive(this.stuntMode);
            this.scoreText.gameObject.SetActive(this.stuntMode);
        }
Example #2
0
        void Start()
        {
            this.vp = this.GetComponent <VehicleParent>();

            //Get transmission for using reverse lights
            if (this.transmission)
            {
                if (this.transmission is GearboxTransmission)
                {
                    this.gearTrans = this.transmission as GearboxTransmission;
                }
                else if (this.transmission is ContinuousTransmission)
                {
                    this.conTrans = this.transmission as ContinuousTransmission;
                }
            }
        }
Example #3
0
    public void SpawnVehicle(int vehicle = 0)
    {
        //newVehicle = Instantiate(vehicles[vehicle], spawnPoint, Quaternion.LookRotation(spawnRot, GlobalControl.worldUpDir)) as GameObject;
        //cam.target = newVehicle.transform;
        //cam.Initialize();
        vp = newVehicle.GetComponent <VehicleParent>();

        trans = newVehicle.GetComponentInChildren <Transmission>();
        if (trans)
        {
            trans.automatic = autoShift;
            //newVehicle.GetComponent<VehicleParent>().brakeIsReverse = autoShift;

            if (trans is GearboxTransmission)
            {
                gearbox = trans as GearboxTransmission;
            }
            else if (trans is ContinuousTransmission)
            {
                varTrans = trans as ContinuousTransmission;
                if (!autoShift)
                {
                    vp.brakeIsReverse = true;
                }
            }
        }

        if (newVehicle.GetComponent <VehicleAssist>())
        {
            newVehicle.GetComponent <VehicleAssist>().enabled = assist;
        }

        if (newVehicle.GetComponent <FlipControl>() && newVehicle.GetComponent <StuntDetect>())
        {
            newVehicle.GetComponent <FlipControl>().flipPower          = stuntMode && assist ? new Vector3(10, 10, -10) : Vector3.zero;
            newVehicle.GetComponent <FlipControl>().rotationCorrection = stuntMode ? Vector3.zero : (assist ? new Vector3(5, 1, 10) : Vector3.zero);
            newVehicle.GetComponent <FlipControl>().stopFlip           = assist;
            //stunter = newVehicle.GetComponent<StuntDetect>();
        }

        engine         = newVehicle.GetComponentInChildren <Motor>();
        propertySetter = newVehicle.GetComponent <PropertyToggleSetter>();

        stuntText.gameObject.SetActive(stuntMode);
        scoreText.gameObject.SetActive(stuntMode);
    }
Example #4
0
	void Start()
	{
		vp = GetComponent<VehicleParent>();

		//Get transmission for using reverse lights
		if (transmission)
		{
			if (transmission is GearboxTransmission)
			{
				gearTrans = transmission as GearboxTransmission;
			}
			else if (transmission is ContinuousTransmission)
			{
				conTrans = transmission as ContinuousTransmission;
			}
		}
	}
    public void SpawnVehicle(int vehicle)
    {
        newVehicle = Instantiate(vehicles[vehicle], spawnPoint, Quaternion.LookRotation(spawnRot, GlobalControl.worldUpDir)) as GameObject;
        cam.target = newVehicle.transform;
        cam.Initialize();
        vp = newVehicle.GetComponent<VehicleParent>();

        cam.GetComponent<CameraControlls>().cameraTarget = newVehicle.transform;

        trans = newVehicle.GetComponentInChildren<Transmission>();
        if (trans)
        {
            trans.automatic = autoShift;
            newVehicle.GetComponent<VehicleParent>().brakeIsReverse = autoShift;

            if (trans is GearboxTransmission)
            {
                gearbox = trans as GearboxTransmission;
            }
            else if (trans is ContinuousTransmission)
            {
                varTrans = trans as ContinuousTransmission;

                if (!autoShift)
                {
                    vp.brakeIsReverse = true;
                }
            }
        }

        if (newVehicle.GetComponent<VehicleAssist>())
        {
            newVehicle.GetComponent<VehicleAssist>().enabled = assist;
        }

        if (newVehicle.GetComponent<FlipControl>() && newVehicle.GetComponent<StuntDetect>())
        {
            newVehicle.GetComponent<FlipControl>().flipPower = stuntMode && assist ? new Vector3(10, 10, -10) : Vector3.zero;
            newVehicle.GetComponent<FlipControl>().rotationCorrection = stuntMode ? Vector3.zero : (assist ? new Vector3(5, 1, 10) : Vector3.zero);
            newVehicle.GetComponent<FlipControl>().stopFlip = assist;
            stunter = newVehicle.GetComponent<StuntDetect>();
        }

        engine = newVehicle.GetComponentInChildren<Motor>();
        propertySetter = newVehicle.GetComponent<PropertyToggleSetter>();

        stuntText.gameObject.SetActive(stuntMode);
        scoreText.gameObject.SetActive(stuntMode);
    }