Ejemplo n.º 1
0
	private void Start() 
	{
		if(GameObject.FindWithTag ("MultiplayerManager"))
		{
			players = GameObject.FindGameObjectsWithTag ("Player");
			for(int i = 0; i < players.Length; i++)
			{
				if(players[i].GetComponent<NetworkIdentity>().isLocalPlayer)
				{
					m_Target = players[i].transform.FindChild ("CameraTarget");
				}
			}
		}
		else
		{
			m_Target = GameObject.Find ("CameraTarget").transform;
		}
		
		targetRigidbody = m_Target.root.GetComponent<Rigidbody>();
		carEngine = m_Target.root.GetComponent<CarEngine>();
		carSetup = carEngine.GetComponent<CarSetup>();
        radialBlur = GetComponent<CC_RadialBlur>();
		
		if(GameObject.Find ("DriftManager"))
		{
			carDrifting = GameObject.Find ("DriftManager").GetComponent<CarDrifting>();
		}
	}
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        layer = gameObject.layer;

        Setup = GetComponent <CarSetup>();

        material = Setup.intenceRed;

        guns = CarSetup.FindGameObjectInChildWithName(transform, "gun");

        bulletCD     = 1 / rateOfFire;
        bulletPrefab = new GameObject("bullet");
        bulletPrefab.SetActive(false);

        bulletDecal = new GameObject("bulletDecal");
        bulletDecal.SetActive(false);

        bulletDecal = Resources.Load <GameObject>("bulletHit");

        CarSetup.initMesh(bulletPrefab, Resources.Load <Mesh>("bullet"), material);
        ProyectileController bullet = bulletPrefab.AddComponent <ProyectileController>();

        bullet.mode   = ProyectileMode.bullet;
        bullet.speed  = bulletSpeed;
        bullet.damage = bulletDamage;
        bullet.layer  = layer;

        bulletTimer = new Cooldown();
        bulletTimer.init(0, bulletCD);
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        health = GetComponent <HealthModule>();

        layer = LayerMask.NameToLayer("shield");
        Setup = GetComponent <CarSetup>();

        shieldPrefab      = Instantiate(Resources.Load <GameObject>("shieldSphere"), transform);
        shieldPrefab.name = "shield";
        GameObject collider = CarSetup.FindGameObjectInChildWithName(shieldPrefab.transform, "collider")[0];

        collider.SetActive(false);
        MeshCollider coll = shieldPrefab.AddComponent <MeshCollider>();

        coll.sharedMesh     = collider.GetComponent <MeshFilter>().sharedMesh;
        coll.convex         = true;
        coll.sharedMaterial = Resources.Load <PhysicMaterial>("PhysicsMaterials/noFriction");
        shieldPrefab.layer  = layer;
        shieldPrefab.transform.localScale = Vector3.zero;

        shieldPrefab.SetActive(false);

        castingTimer = new Cooldown();
        castingTimer.init(0, castTime);
        //shieldPrefab.transform.position = transform.position;
        //shieldPrefab.transform.parent = transform;
    }
Ejemplo n.º 4
0
 private void Start()
 {
     carEngine = GameObject.FindWithTag ("Player").GetComponent<CarEngine>();
     carSetup = carEngine.GetComponent<CarSetup>();
     speedRPM = Vector3.zero;
     initZ = rectTransform.localRotation.eulerAngles.z;
 }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        Setup = GetComponent <CarSetup>();

        flySlider   = Setup.canvas.transform.Find("Slider2").GetComponent <Slider>();
        moveManager = GetComponent <BasicMovement>();
        flyGauge    = new Cooldown();
        flyGauge.init(flyLength, flyCD, recoveryCD);
        flySlider.maxValue = flyLength;
        flySlider.value    = flySlider.maxValue;
    }
Ejemplo n.º 6
0
        private void CarMapping()
        {
            var ec = new EngineConfiguration {
                ModelNumber = "1A", ModelYear = 2013
            };
            var cs = new CarSetup {
                Configuration = ec, VIN = "123"
            };

            var info = Mapper.Map <CarSetup, CarInfo>(cs);
        }
Ejemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        Setup = GetComponent <CarSetup>();

        material        = Setup.intenceRed;
        pointerMaterial = Setup.transparentRedTexture;

        layer  = gameObject.layer;
        camera = Setup.camera;

        targetImage = Setup.canvas.transform.Find("targeting").gameObject;

        targetingRect = targetImage.GetComponent <RectTransform>();
        CanvasRect    = Setup.canvas.GetComponent <RectTransform>();

        targetImage.SetActive(false);
        cannons = CarSetup.FindGameObjectInChildWithName(transform, "cannon");



        missilePrefab = new GameObject("missile");
        missilePrefab.SetActive(false);
        missileDecal = new GameObject("missileDecal");
        missileDecal.SetActive(false);
        missileDecal = Resources.Load <GameObject>("explotionDecal");

        pointerPrefab = new GameObject("pointer");
        pointerPrefab.SetActive(false);
        CarSetup.initMesh(pointerPrefab, Resources.Load <Mesh>("pointer"), pointerMaterial);

        CarSetup.initMesh(missilePrefab, Resources.Load <Mesh>("missile"), material);

        MeshCollider collider = missilePrefab.AddComponent <MeshCollider>();

        collider.sharedMesh = Resources.Load <Mesh>("missile");
        collider.convex     = true;
        missilePrefab.AddComponent <Rigidbody>().mass = 5;

        ProyectileController missileController = missilePrefab.AddComponent <ProyectileController>();

        missileController.mode            = ProyectileMode.missile;
        missileController.propultion      = propultion;
        missileController.damage          = missileDamage;
        missileController.layer           = layer;
        missileController.explotionForce  = explotionForce;
        missileController.explotionRadius = explotionRadius;
        missileController.decal           = missileDecal;
    }
Ejemplo n.º 8
0
    private GameObject setCar(GameObject originalCar, Vector3 position, Quaternion rotation, int selfLayer, Camera camera, GameObject canvas, Material material)
    {
        GameObject car = Instantiate(originalCar, position, rotation);

        camera.transform.position = (car.transform.forward * -20) + (car.transform.up * 10);
        camera.transform.LookAt(car.transform);

        CarSetup.SetLayerAll(car.transform, selfLayer);

        CarSetup carSetup = car.AddComponent <CarSetup>();

        carSetup.asBot  = false;
        carSetup.camera = camera;

        GameObject newCanvas = Instantiate(canvas);

        foreach (Transform guiElement in newCanvas.transform)
        {
            RectTransform rect = guiElement.GetComponent <RectTransform>();

            rect.anchoredPosition = new Vector2(rect.anchoredPosition.x * camera.rect.width, rect.anchoredPosition.y * camera.rect.height);
        }

        newCanvas.SetActive(true);
        carSetup.canvas               = newCanvas.GetComponent <Canvas>();
        carSetup.canvas.renderMode    = RenderMode.ScreenSpaceCamera;
        carSetup.canvas.worldCamera   = camera;
        carSetup.canvas.planeDistance = camera.nearClipPlane + CarSetup.minSurfaceDistance;


        car.AddComponent <BasicMovement>();
        car.AddComponent <HealthModule>();
        car.AddComponent <FlyModule>();
        car.AddComponent <ShieldModule>();
        car.AddComponent <GunModule>();
        car.AddComponent <MissileModule>();
        car.AddComponent <MineModule>();

        carSetup.Set();


        car.name       = "Car - " + carSetup.playerName;
        newCanvas.name = "Canvas" + carSetup.playerID;
        car.SetActive(true);

        carSetup.setMaterial(material);
        return(car);
    }
Ejemplo n.º 9
0
        public void LoadCarConfigValues_Load_ValuesAreLoadedFromJson()
        {
            // Arrange
            var file     = File.ReadAllText($"SetupsTests\\Safe.json");
            var carSetup = new CarSetup();

            // Act
            carSetup.LoadCarConfigValues(file);

            // Assert
            var components = carSetup.CarConfigComponents;

            components[0].ConfigValues.Should().Be("ferrari_488_gt3_evo");
            components[1].ConfigValues.Should().Be("0");
            components[2].ConfigValues.Should().Be("[\r\n  56,\r\n  56,\r\n  53,\r\n  53\r\n]");
        }
Ejemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        Setup = GetComponent <CarSetup>();

        wheelsDirAxis     = Setup.GetDirectionalAxis();
        wheelsDirCollider = new WheelCollider[wheelsDirAxis.Length];
        defaultRotation   = new Quaternion[wheelsDirAxis.Length];

        for (int a = 0; a < wheelsDirAxis.Length; a++)
        {
            wheelsDirCollider[a] = wheelsDirAxis[a].GetComponentInChildren <WheelCollider>();
            defaultRotation[a]   = wheelsDirAxis[a].transform.localRotation;
        }

        wheelsTracCollider = Setup.GetWheelsTractionColliders();
        rigidBody          = GetComponent <Rigidbody>();
    }
Ejemplo n.º 11
0
    void Start()
    {
        helices = CarSetup.FindGameObjectInChildWithName(transform, "helice");

        if (armsA != null)
        {
            armsA = CarSetup.FindGameObjectInChildWithName(transform, "armA");
        }
        if (armsB != null)
        {
            armsB = CarSetup.FindGameObjectInChildWithName(transform, "armB");
        }

        rotsArmsA = new Vector3[armsA.Length];
        rotsArmsB = new Vector3[armsB.Length];



        for (int a = 0; a < armsA.Length; a++)
        {
            rotsArmsA[a] = armsA[a].transform.rotation.eulerAngles;
        }
        for (int a = 0; a < armsB.Length; a++)
        {
            rotsArmsB[a] = armsB[a].transform.rotation.eulerAngles;
        }

        if (targRotsArmsA == null)
        {
            for (int a = 0; a < rotsArmsA.Length; a++)
            {
                targRotsArmsA[a] = rotsArmsA[a];
            }
        }
        if (targRotsArmsB == null)
        {
            for (int a = 0; a < rotsArmsB.Length; a++)
            {
                targRotsArmsB[a] = rotsArmsB[a];
            }
        }

        lastPositionY = transform.position.y;
        GetComponent <Rigidbody>().AddForce(Vector3.up * throwForce, ForceMode.Impulse);
    }
Ejemplo n.º 12
0
        public void UpdateCarConfigValues_SingleUpdate_RawJsonObjectIsUpdated()
        {
            // Arrange
            var file     = File.ReadAllText($"SetupsTests\\Safe.json");
            var carSetup = new CarSetup();

            carSetup.LoadCarConfigValues(file);

            // Act

            carSetup.UpdateCarSetupComponent("basicSetup.tyres.tyreCompound", "1");
            carSetup.UpdateCarConfigValues();

            // Assert
            var rawJsonObject = carSetup.RawJsonSetup;

            rawJsonObject["basicSetup"]["tyres"]["tyreCompound"].ToString().Should().Be("1");
        }
Ejemplo n.º 13
0
    // Use this for initialization

    void Start()
    {
        layer = gameObject.layer;
        Setup = GetComponent <CarSetup>();

        material = Setup.intenceRed;

        minePrefab = new GameObject("mine");
        minePrefab.SetActive(false);
        mineDecal = new GameObject("mineDecal");
        mineDecal.SetActive(false);
        mineDecal = Resources.Load <GameObject>("explotionDecal");

        GameObject mineObject = Resources.Load <GameObject>("mine");

        CarSetup.initMesh(minePrefab, mineObject.transform.Find("mine_mesh").GetComponent <MeshFilter>().sharedMesh, material);
        MeshCollider sensor = minePrefab.AddComponent <MeshCollider>();

        sensor.sharedMesh = mineObject.transform.Find("mine_sensor").GetComponent <MeshFilter>().sharedMesh;
        sensor.convex     = true;
        sensor.isTrigger  = true;


        MeshCollider collider = minePrefab.AddComponent <MeshCollider>();

        collider.sharedMesh = mineObject.transform.Find("mine_collider").GetComponent <MeshFilter>().sharedMesh;
        collider.convex     = true;
        Rigidbody rb = minePrefab.AddComponent <Rigidbody>();

        rb.mass = 5;
        rb.collisionDetectionMode = CollisionDetectionMode.Continuous;

        minePrefab.layer = layer;

        ExplosiveController explosive = minePrefab.AddComponent <ExplosiveController>();

        explosive.useSensor       = true;
        explosive.damage          = explotionDamage;
        explosive.layer           = layer;
        explosive.explotionForce  = explotionForce;
        explosive.explotionRadius = explotionRadius;
        explosive.decal           = mineDecal;
    }
Ejemplo n.º 14
0
    private void Start()
    {
        // Get object references
        setup = GetComponent<CarSetup>();

        if(transform.FindChild("NosFire"))
        {
            nosFire = transform.FindChild ("NosFire").gameObject;
        }

        if(setup.NitroEnable)
        {
            if(nosFire != null) nosFire.SetActive (true);

        }
        else
        {
            if(nosFire != null) nosFire.SetActive (false);
        }

        // Set up lights configuration
        SetupFrontLights();

        SetupBreakLights();

        SetupReverseLights();
    }
Ejemplo n.º 15
0
	private void Start()
	{
		rigidbodyTransform = transform;
		
		while (rigidbodyTransform != null && rigidbodyTransform.GetComponent<Rigidbody>() == null)
		{
			rigidbodyTransform = rigidbodyTransform.parent;
		}
		
		if (rigidbodyTransform != null)
		{
			body = rigidbodyTransform.GetComponent<Rigidbody>();
		}
		
		InitSlipMaxima();

        carSetup = transform.root.GetComponent<CarSetup>();

        SkidmarkObject = GameObject.Find(carSetup.SkidmarkObjectName);
		
		if (SkidmarkObject != null)
		{
			m_skidNotEarthFX = SkidmarkObject.GetComponentInChildren(typeof(CarSkidmarks)) as CarSkidmarks;
			m_SkidSmoke = SkidmarkObject.GetComponentInChildren(typeof(ParticleEmitter)) as ParticleEmitter;
		}
		
	}
Ejemplo n.º 16
0
 void Start()
 {
     UI_Instance = CarSetup.Get_UI_Instance();
     ui          = UI_Instance.GetComponent <PlayerUI>();
 }
Ejemplo n.º 17
0
 private void Start()
 {
     carSetup = GetComponent<CarSetup>();
     carEngine = GetComponent<CarEngine>();
 }
Ejemplo n.º 18
0
    private void FixedUpdate()
    {
        if (!hasSetup)
        {
            hasSetup = true;
            CarSetup cs = gm.inter.Setup();
            Recolor(cs.color);
        }
        int frames = gm.physicsFramesSinceStart;

        if (gm.inter.HasCommands())
        {
            waitingForCommands = false;
            cmds = gm.inter.GetCommands();
            ui.ShowCommands(cmds);
        }

        m_Car.Move(cmds.steering, cmds.acceleration, cmds.brake);
        applyNitro(cmds.nitro);

        if (checkStuck())
        {
            Debug.Log("Stuck!");
            ui.FloatingText("Stuck!\nReset to last waypoint");
            respawn();
        }
        if (rb.position.y < -1f)
        {
            Debug.Log("Too low!");
            ui.FloatingText("Drowning/falling!\nReset to last waypoint");
            respawn();
        }

        //record metrics
        fuelUsed           += Mathf.Abs(cmds.acceleration);
        top_speed           = Math.Max(top_speed, rb.velocity.magnitude);
        distance_travelled += rb.velocity.magnitude * Time.fixedDeltaTime;

        // record ghost
        if (frames % historyFramerate == 0)
        {
            Vector3    position = rb.transform.position;
            Quaternion rotation = rb.transform.rotation;
            history.Add(new TransformData(position, rotation));
        }

        if (!waitingForCommands && frames >= lastUpdate + updateEvery)
        {
            lastUpdate = frames;

            PlayerData data;
            data.speed      = rb.velocity.magnitude;
            data.nitro_left = nitroFuel;

            Vector3[] waypoints = tc.GetNextMarkers(lastVisited, 2);
            Vector3   waypoint  = waypoints[0] - rb.position;
            data.waypoint_distance = waypoint.magnitude;
            data.waypoint_bearing  = Vector3.SignedAngle(waypoint, transform.forward, Vector3.up);
            waypoint = waypoints[1] - rb.position;
            data.future_waypoint_distance = waypoint.magnitude;
            data.future_waypoint_bearing  = Vector3.SignedAngle(waypoint, transform.forward, Vector3.up);

            List <ODRay> odrays = ODRays(45, new float[] { 0, 2, 6, 10, 22, 45 }, new float[] { 150, 100, 90, 40, 40, 30 });
            data.obstacle_detection_rays = odrays.ToArray();

            data.time   = frames * Time.fixedDeltaTime;
            data.frames = frames;

            ui.ShowData(data);
            gm.inter.NewData(data);
            waitingForCommands = true;
        }
    }
Ejemplo n.º 19
0
    public void Awake()
    {
        // Pre-Initialize values
        CarEngine = GetComponent(typeof(CarEngine)) as CarEngine;
        CarSetup = GetComponent(typeof(CarSetup)) as CarSetup;

        SetupAudioSources();

        for (int i = 0; i < this.RPMLevels.Length; i++)
        {
            this.RPMLevels[i].Source = ((i % 2) != 0) ? this.AudioChannel2 : this.AudioChannel1;
        }
        this.rpmLevelStages[0] = new RPMLevelStage();
        this.rpmLevelStages[1] = new RPMLevelStage();

        if (this.AudioChannel1 != null)
        {
            this.AudioChannel1.loop = true;
            this.AudioChannel1.volume = 0f;
        }
        if (this.AudioChannel2 != null)
        {
            this.AudioChannel2.loop = true;
            this.AudioChannel2.volume = 0f;
        }

        isPaused = false;
        blnIsTurboInRange = false;

        rpmLevelStage = null;
        rpmLevel = null;

        currentRPMDiff = 0.0f;
        levelRPMDiff = 0.0f;
        rpmTime = 0.0f;
        pitchDiff = 0.0f;
        stageRPMCoef = 0.0f;

        levelStage1 = null;
        levelStage2 = null;

        auxObject = null;

        sources = GetComponentsInChildren<AudioSource>();
    }
Ejemplo n.º 20
0
    private void Start()
    {
        volumeFadeIn = true;
        AudioListener.volume = 0.0f;

        // Initialize values
        pauseAnimation = false;
        pause = false;
        started = false;
        settings = false;
        isDrifting = false;
        canContinue = false;
        canDrift = true;
        canShowExtra = true;
        avoiding = false;
        pressedExit = false;
        tutorial = false;
        canAdvanceTutorial = true;
        driftTutorial = false;
        driftTutorialObjective = false;
        driftTutorialDriftDone = false;
        checkingGamepad = false;
        disabledUI = false;
        totalScore = 0;
        driftScore = 0;
        maxDriftScore = 0;
        multiplier = 0;
        challengeTextState = 0;
        tutorialState = 0;
        driftTutorialState = 0;
        playerName = "";
        previousTimeScale = Time.timeScale;
        rigidbodyVelocity = Vector3.zero;
        multiplierTemp = multiplierTempInit;
        collisionTemp = collisionTempInit;
        avoidTemp = avoidTempInit;
        initPosition = new Vector3[labelsUI.Length];
        dataManager = DataManager.Instance;
        carInput = CarInput.Instance;

        // Initialize time challenge values
        leftTime = leftTimeInit;
        timePickupsCount = timePickupRoot.transform.childCount;
        currentTimePickup = 0;

        timePickups = new GameObject[timePickupsCount];

        for(int i = 0; i < timePickups.Length; i++)
        {
            timePickups[i] = timePickupRoot.transform.GetChild (i).gameObject;
        }

        for(int i = 0; i < timePickups.Length; i++)
        {
            timePickups[i].GetComponent<DriftPickup>().DisablePickupForMinimap();
        }

        timeChallengeUI.SetActive (false);

        for(int i = 0; i < freeTutorialLabels.Length; i++)
        {
            freeTutorialCameras[i].enabled = false;
            freeTutorialLabels[i].SetActive (false);
        }

        for(int i = 0; i < challengeTutorialCameras.Length; i++)
        {
            challengeTutorialCameras[i].enabled = false;
            challengeTutorialLabels[i].SetActive (false);
        }

        // Get player references
        carController = GameObject.FindWithTag ("Player").GetComponent<CarController>();
        carEngine = carController.GetComponent<CarEngine>();
        carSetup = carController.GetComponent<CarSetup>();
        carAudio = carController.GetComponent<CarAudio>();
        carRigidbody = carController.GetComponent<Rigidbody>();
        introAnimation = GetComponent<CameraIntroAnimation>();
        settingsManager = GetComponent<SettingsManager>();
        extraTweenText = extraTween.GetComponent<Text>();
        challengeLabelTween = challengeLabel.GetComponent<TweenFontSize>();
        bloomUI = GameObject.Find ("UICamera").GetComponent<Bloom>();

        if(dataManager.isGamepad)
        {
            #if !UNITY_EDITOR
            UnityEngine.Cursor.visible = false;
            UnityEngine.Cursor.lockState = CursorLockMode.Locked;
            #endif
        }
        else
        {
            #if !UNITY_EDITOR
            UnityEngine.Cursor.visible = false;
            UnityEngine.Cursor.lockState = CursorLockMode.None;
            #endif
        }

        // Load data
        maxDriftScore = dataManager.bestDrift;

        for(int i = 0; i < labelsUI.Length; i++)
        {
            labelsUI[i].color = initColor;
            auxColor = labelsUI[i].color;
            auxColor.a = initAlpha;
            labelsUI[i].color = auxColor;
            initPosition[i] = labelsUI[i].transform.position;
        }

        pauseUI.SetActive (false);
        settingsUI.SetActive (false);
        gameplayUI.SetActive (false);
        startUI.SetActive(false);
        bloomUI.enabled = false;

        carController.enabled = false;
        carEngine.enabled = false;
        carSetup.enabled = false;
        carRigidbody.isKinematic = true;
        //carRigidbody.constraints = RigidbodyConstraints.FreezeAll;

        // Disable car audio
        carAudio.EnableSources(0.5f);

        EventSystem.current.SetSelectedGameObject(null);
    }
Ejemplo n.º 21
0
	private void Start () 
	{ 
		// Initialize values
		engine 			= GetComponent<CarEngine>();		
		carSetup 		= GetComponent<CarSetup>();
		wheels 			= carSetup.Wheels;
		basicMaxRPM 	= carSetup.EngineMaxRPM;
		lightsSetup		= GetComponent<LightsSetup>();
		audioSource     = GetComponent<AudioSource>();
		cameraRig 	 	= GetComponent<CameraRig>();
		carRigidbody	= GetComponent<Rigidbody>();
		carInput        = CarInput.Instance;
		rumbling		= false;
		rumbleTemp		= rumbleTempInit;
		auxObject		= null;
		dataManager		= DataManager.Instance;
		sparksManager	= GameObject.Find ("SparksManager").GetComponent<SparksManager>();
		lookBack		= false;
		respawnTemp		= respawnTempInit;
		isPlayer		= false;
		
		if(GetComponent<NetworkIdentity>())
		{
			netIdentity		= GetComponent<NetworkIdentity>();
			isPlayer		= netIdentity.isLocalPlayer;
		}
		else
		{
			isPlayer		= true;
		}
		
		// Set up visual car
        switch(Application.platform)
		{
			case RuntimePlatform.WindowsEditor:
			case RuntimePlatform.WindowsPlayer:
			case RuntimePlatform.WindowsWebPlayer:
			{
				for(int i = 0; i < lowObjects.Length; i++)
                {
                    lowObjects[i].SetActive (false);
                }
                for(int i = 0; i < highObjects.Length; i++)
                {
                    highObjects[i].SetActive (true);
                }
				break;
			}
			case RuntimePlatform.WebGLPlayer:
			case RuntimePlatform.IPhonePlayer:
			case RuntimePlatform.BlackBerryPlayer:
			case RuntimePlatform.Android:
			{
				for(int i = 0; i < lowObjects.Length; i++)
                {
                    lowObjects[i].SetActive (true);
                }
                for(int i = 0; i < highObjects.Length; i++)
                {
                    highObjects[i].SetActive (false);
                }
				break;
			}
			default:
			{
				for(int i = 0; i < lowObjects.Length; i++)
                {
                    lowObjects[i].SetActive (true);
                }
                for(int i = 0; i < highObjects.Length; i++)
                {
                    highObjects[i].SetActive (false);
                }
				break;
			}
		}
		
		renderers = GetComponentsInChildren<MeshRenderer>();
	}
Ejemplo n.º 22
0
 public void StartGamePlayer()
 {
     // Get player references
     players = GameObject.FindGameObjectsWithTag("Player");
     for(int i = 0; i < players.Length; i++)
     {
         if(players[i].GetComponent<NetworkIdentity>().isLocalPlayer)
         {
             carController = players[i].GetComponent<CarController>();
             carEngine = carController.GetComponent<CarEngine>();
             carSetup = carController.GetComponent<CarSetup>();
             carAudio = carController.GetComponent<CarAudio>();
             carRigidbody = carController.GetComponent<Rigidbody>();
             carController.enabled = false;
             carEngine.enabled = true;
             // Disable car audio
             carAudio.EnableSources(0.5f);
             Debug.Log ("MultiplayerManager: player initialization complete");
             break;
         }
     }
 }