public void initHumanCar(IRDSCarControllerAI aCar) { if(carCamera==null) { carCamera = GameObject.Find ("Main_Camera").GetComponent<IRDSCarCamera> ();; if(GameObject.Find("RaceStartCamera")!=null) { carCamera.GetComponent<Camera>().enabled = false; raceStartCamera = GameObject.Find ("RaceStartCamera").GetComponent<Camera>();; } } RacingAI thisCarsAI = aCar.GetComponent<RacingAI>(); thisCarsAI.aiInput = aCar.GetComponent<IRDSCarControllInput>(); racingAIs.Add(thisCarsAI); if(selectedCar==null) { selectedCar = thisCarsAI; selectedCar.aiInput = selectedCar.GetComponent<IRDSCarControllInput>(); selectedCar.aiCar.onRaceStart += onStartedRace; carCamera.changeTarget(selectedCar.aiInput.GetInstanceID()); } if(racingAIs.Count==2) { changeCar(); } if(carInterface==null) { carInterface = GameObject.Find("IndividualRaceInterface").GetComponent<IndividualCarInterfaceManager>(); } carInterface.targetAI = selectedCar; }
// public CarLibrary carLib; // Use this for initialization void Start () { lastUpdate = Time.time; REF = this; Time.timeScale = 1f; carCamera = GameObject.Find("Main_Camera").GetComponent<IRDSCarCamera>(); levLoad = GameObject.Find ("LevelLoad").GetComponent<IRDSLevelLoadVariables>(); levLoad.laps = 3; //Screen.SetResolution(640, 480, true); carCamera.ActivateRoadCamera (); if (TeamDatabase.REF == null) { return; } GameObject light = GameObject.Find("Directional Light"); Light dl = light.GetComponent<Light>(); switch(SettingsScreen.shadowLevel) { case(0):dl.shadows = LightShadows.None;break; case(1):dl.shadows = LightShadows.Hard;break; case(2):dl.shadows = LightShadows.Soft;break; } NGUIDisabler.PAUSED_TIME_SCALE = 0.1f; // Time.timeScale = 4; manager = GameObject.Find ("IRDSManager").GetComponent<IRDSManager> (); statistics =manager.GetComponentInChildren<IRDSStatistics>(); statistics.startRaceManually = true; // statistics.StartTheRace(); carCamera = manager.GetComponentInChildren<IRDSCarCamera>(); placeCars = manager.gameObject.GetComponentInChildren<IRDSPlaceCars> (); // BetterList<IRDSCarControllerAI> allCars = new BetterList<IRDSCarControllerAI> (); genericRaceGUI = GameObject.Find("GenericRaceGUI"); UILabel totalLaps = GameObject.Find("LAP").GetComponent<UILabel>(); driver1Label = GameObject.Find("DriverMessage1").GetComponent<UILabel>(); driver2Label = GameObject.Find("DriverMessage2").GetComponent<UILabel>(); simSpeedBtn = GameObject.Find("SimSpeedButton").GetComponent<UIButton>(); simSpeedLbl = GameObject.Find("SimSpeedButton").GetComponent<UILabel>(); simSpeedBtn.onClick.Add(new EventDelegate(this,"onSimSpeedChange")); if(genericRaceGUI!=null) { genericRaceGUI.gameObject.SetActive(false); } List<GTDriver> driversInRace = ChampionshipRaceSettings.ACTIVE_RACE.driversForRace(); totalLaps.text = "/ "+this.levLoad.laps; GameObject raceStarters = GameObject.Find("RaceLineupPanel"); if(raceStarters!=null) { raceStartersTable = raceStarters.GetComponent<RaceStarterTable>(); raceStartersTable.activate(driversInRace); } for(int i = 0;i<this.fv.Count;i++) { fv[i].enabled = true; } if(levLoad.raceStartType!=IRDSLevelLoadVariables.RaceStartType.Rolling) { StartCoroutine(makeCars()); } else { raceStartersTable.allowRaceStart(); } // }
void Start() { carCamera = GetComponent<IRDSCarCamera>(); carCamera.DeactivateRoadCamera(); }