public GTCar otherCar(GTCar aThisCar) { if(cars[0]==aThisCar) { return cars[1]; } else { return cars[0]; } }
public void init(CarDetails aCarDetailsScreen,GTCar aCarToReplace) { GarageManager.REF.interfacePanel.gameObject.SetActive(false); GarageCameraController camController = GameObject.Find("Main Camera").GetComponent<GarageCameraController>(); btnBuyCar = GameObject.Find ("BtnBuyCar").GetComponent<UIButton>(); camController.lookAtThis = GameObject.Find ("GarageCenter"); GameObject g = GameObject.Find("CameraPathForCarOnSale"); GameObject lbl = GameObject.Find ("lblDivisionLabel"); centerLight = GameObject.Find ("Center Car Spotlight"); lblDivisionLabel = lbl.GetComponent<UILabel>(); if(g!=null) { CameraPath cp = g.GetComponent<CameraPath>(); cp.enabled = true; CameraPathAnimator cpa = g.GetComponent<CameraPathAnimator>(); cpa.enabled = true; } Lean.LeanTouch.OnFingerSwipe += OnFingerSwipe; _carToReplace = aCarToReplace; _carDetailsScreen = aCarDetailsScreen; GTTeam team = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam(); int division = ChampionshipSeason.ACTIVE_SEASON.leagueForTeam(team).divisionNumber; int i = 0; for(i = 0;i<CarDatabase.REF.cars.Count;i++) { if(CarDatabase.REF.cars[i].leagueRequired>=division) { continue; } else { break; } } i--; currentIndex = i; showCar(currentIndex); }
public void initResearch(RnDRow aRow,GTCar aCar,UISprite aSprite) { this.gameObject.SetActive(true); researchRow = aRow; carRef = aCar; GTEquippedResearch r = carRef.hasPart(aRow); if(r==null) { partNameTitle.text = aRow._partname+" (0/"+aRow._maxlevelstounlock+")"; } else { partNameTitle.text = aRow._partname+" ("+r.activeLevel+"/"+aRow._maxlevelstounlock+")"; } partDescription.text = aRow._partdescription; // divisionRequired.text = "Division Required: "+aRow._partprerequisitedivision; if(aRow._partprerequisites.Length==0) { prerequisiteParts.text = "Prerequisite Parts: None"; } else { prerequisiteParts.text = "Prerequisite Parts: "+aRow._partprerequisites; } lblCost.text = "Cost to Research: "+aRow._costtoresearch.ToString("C0"); this.lblDaysToResearch.text = "Days to Research: "+aRow._daystoresearch; partGraphic.spriteName = aSprite.spriteName; if(this.carRef.partBeingResearched!=null) { startResearchBtn.isEnabled = false; } }
public TeamDataRecord (TeamNamesRow aTeamNameRow) { id = aTeamNameRow._id; name = aTeamNameRow._teamname; description = aTeamNameRow._teamdescription; teamColor = new Color(aTeamNameRow._teamcolorr/255f,aTeamNameRow._teamcolorg/255f,aTeamNameRow._teamcolorb/255f); wheelColor = new Color(aTeamNameRow._wheelcolorr/255f,aTeamNameRow._wheelcolorg/255f,aTeamNameRow._wheelcolorb/255f); startLeague = aTeamNameRow._startleague; carA = new GTCar (aTeamNameRow._startingcar1); reputation = aTeamNameRow._reputation; driverA = new GTDriver (); DriverLibraryRecord driverRecord = DriverLibrary.REF.getAvailableDriver(); driverRecord.assignedTeam = id; driverA.initFromLibrary(driverRecord); carB = new GTCar (aTeamNameRow._startingcar2); driverB = new GTDriver (); driverRecord = DriverLibrary.REF.getAvailableDriver(); driverB.initFromLibrary(driverRecord); driverRecord.assignedTeam = id; }
public WheelInfo (IRDSWheel aWheel,GTCar aCar,bool aFront) { _wheelRef = aWheel; _wheelRef.SetWear(true); _wheelRef.realTireMode = true; _wheelRef.SetTyreHardness(aCar.tireHardnessValue); _wheelRef.SetGrip(aCar.grip()); if(aFront) _wheelRef.SetBrakeFrictionTorque(aCar.frontBrakeTorque); if(!aFront) _wheelRef.SetBrakeFrictionTorque(aCar.rearBrakeTorque); }
public virtual void FromString(string aString) { string uncom = Base64.Base64Decode(aString); string[] s = uncom.Split(new char[] {'|'}); GTDriver d = new GTDriver(); d.FromString(s[0]); this.drivers.Add(d); d = new GTDriver(); d.FromString(s[1]); this.drivers.Add(d); GTCar c = new GTCar(); c.FromString(s[2]); this.cars.Add(c); c = new GTCar(); c.FromString(s[3]); this.cars.Add(c); teamColor.r = (float) Convert.ToDouble(s[4]); teamColor.g = (float) Convert.ToDouble(s[5]); teamColor.b = (float) Convert.ToDouble(s[6]); teamColor.a = 1f; wheelColor.r = (float) Convert.ToDouble(s[7]); wheelColor.g = (float) Convert.ToDouble(s[8]); wheelColor.b = (float) Convert.ToDouble(s[9]); wheelColor.a = 1f; if(s[10].ToLower()=="true") { humanControlled = true; } else { humanControlled = false; } this.teamName = s[11]; this.seasonPoints = Convert.ToInt32(s[12]); this.seasonWins =Convert.ToInt32(s[13]); this.cash = Convert.ToInt32(s[14]); this.reputation = Convert.ToInt32(s[15]); this.id = Convert.ToInt32(s[16]); DriverLibraryRecord rec = DriverLibrary.REF.driverByID(drivers[0].id); rec.assignedTeam = id; rec = DriverLibrary.REF.driverByID(drivers[1].id); rec.assignedTeam = id; ignoreFromRelegationAndPromotion = false; }
public void initFromCar(GTCar aCar) { camController = GameObject.Find("Main Camera").GetComponent<GarageCameraController>(); carRef = aCar; GTTeam team = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam(); this.researchBoxTitle.text = aCar.carLibRecord.name+" - "+team.getDriverFromCar(carRef).name; if(team.cars[0]==aCar) { camController.lookAtThis = GameObject.Find ("GarageLeftSide"); } else { camController.lookAtThis = GameObject.Find ("GarageRightSide"); } if(carRef.partBeingResearched!=null) { this.currentlyResearching.text = "Currently Researching: "+carRef.partBeingResearched.researchRow._partname+" ("+carRef.partBeingResearched.daysOfResearchRemaining+" Day(s) Remaining)"; } else { this.currentlyResearching.text = "Currently Researching: [ff0000]Nothing![-]"; } StartCoroutine(delayToInit()); }
public void initCar() { if(ChampionshipSeason.ACTIVE_SEASON!=null) { GTTeam team = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam(); IRDSCarControllerAI carController = team.cars[indexInTeam].carReference; record = team.cars[indexInTeam].carLibRecord; GameObject thisCar = GameObject.Instantiate(carController.gameObject); car = team.cars[indexInTeam]; thisCar.transform.position = this.gameObject.transform.position; Quaternion q = this.gameObject.transform.rotation; thisCar.transform.rotation = q; RacingAI thisAI = thisCar.GetComponent<RacingAI>(); try { thisAI.initSmokes(); thisAI.hidePilot(); } catch(Exception e) { } thisCarsGameObject = thisCar; team.applySponsorsToCar(thisCarsGameObject); thisAI.engineFailure = Racing.EEngineFailureStage.Normal; thisAI.setEngineFailureStage(); thisAI.recolourCarForTeam(team); Destroy(thisAI.engineBlackSmoke); Destroy(thisAI.engineFire); Destroy(thisAI.engineWhiteSmoke); Destroy(thisAI); IRDSDrivetrain dt = thisCar.GetComponent<IRDSDrivetrain>(); Destroy(dt); IRDSCarControllerAI ai = thisCar.GetComponent<IRDSCarControllerAI>(); Destroy(ai); IRDSCarVisuals cv = thisCar.GetComponent<IRDSCarVisuals>(); Destroy(cv); IRDSCarSetup cs = thisCar.GetComponent<IRDSCarSetup>(); Destroy(cs); this.deleteIRDSClasses(thisCar); } }
public CarDetails createCarDetailsScreen(GameObject aLastScreen,GTCar aCar,bool aShowButtons) { destroyCarDetailsScreen(); GameObject g = NGUITools.AddChild(GameObject.Find ("UI Root"),prefabCarDetails.gameObject); carDetailsScreen = g.GetComponent<CarDetails>(); carDetailsScreen.initCar(aCar); if(!aShowButtons) { carDetailsScreen.disableButtons(); } return carDetailsScreen; }
public GTTeam getTeamFromCar(GTCar aCar) { for(int i = 0;i<leagues.Count;i++) { GTTeam team = leagues[i].getTeamFromCar(aCar); if(team!=null) { return team; } } return null; }
public void switchCar() { carRef = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam().otherCar(carRef); initFromCar(carRef); }
public int indexForCar(GTCar aCar) { for(int i = 0;i<cars.Count;i++) { if(cars[i]==aCar) { return i; } } return -1; }
public void showCar(GTCar aRecord) { if(carTitle==null) { initLabels(); } horsepowerValue.text = ""+aRecord.carHP; torqueValue.text = ""+aRecord.carTorque; this.turboValue.text = "0"; nitroValue.text = ""+aRecord.nitroCapacity; shiftspeedValue.text = ""+aRecord.shiftSpeed+"s"; this.dragValue.text = ""+aRecord.carDragString+" ("+aRecord.carDrag+")"; this.maxSpeedValue.text = ""+aRecord.carMaxSpeed+"MPH"; this.hasDRSValue.text = "Level "+aRecord.hasDRS; gripValue.text = ""+aRecord.grip(); this.carValue.text = ""+aRecord.carValue.ToString("C0"); GTTeam team = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam(); GTDriver driver = team.getDriverFromCar(this.carRef); if(driver!=null) { this.carTitle.text = driver.name+"'s "+aRecord.carLibRecord.name; } }
public void compareCarTo(CarLibraryRecord aNewCar,GTCar aCurrentCar,Color aColorIfBetter,Color aColorIfWorse) { Color colorToUse = Color.black; float diff = aNewCar.carHP - aCurrentCar.carHP; if(aNewCar.carHP>aCurrentCar.carHP) { colorLabel(this.horsepowerBoost,"+"+diff,aColorIfBetter); } else { colorLabel(this.horsepowerBoost,""+diff,aColorIfWorse); } diff = aNewCar.carTorque - aCurrentCar.carTorque; if(aNewCar.carTorque>aCurrentCar.carTorque) { colorLabel(this.torqueBoost,"+"+diff,aColorIfBetter); } else { colorLabel(this.torqueBoost,""+diff,aColorIfWorse); } if(aNewCar.turboPSI>aCurrentCar.getResearchEffectOnTurboPSI()+aNewCar.turboPSI) { colorLabel(this.turboBoost,"",aColorIfBetter); } else { colorLabel(this.turboBoost,"",aColorIfWorse); } diff = aNewCar.maxNitro - aCurrentCar.nitroCapacity; if(aNewCar.maxNitro>aCurrentCar.carLibRecord.maxNitro) { colorLabel(this.nitroBoost,"+"+diff,aColorIfBetter); } else { colorLabel(this.nitroBoost,""+diff,aColorIfWorse); } diff = aCurrentCar.shiftSpeed-aNewCar.carShiftSpeed; if(aNewCar.carShiftSpeed<aCurrentCar.carLibRecord.carShiftSpeed) { colorLabel(this.shiftspeedBoost,""+diff,aColorIfBetter); } else { colorLabel(this.shiftspeedBoost,"+"+diff,aColorIfWorse); } diff = aCurrentCar.carDrag-aNewCar.carDrag; if(aNewCar.carDrag<aCurrentCar.carLibRecord.carDrag) { colorLabel(this.dragBoost,"+",aColorIfBetter); } else { colorLabel(this.dragBoost,"-",aColorIfWorse); } diff = aNewCar.carMaxSpeed-aCurrentCar.carMaxSpeed; if(aNewCar.carMaxSpeed>aCurrentCar.carLibRecord.carMaxSpeed) { colorLabel(this.maxSpeedBoost,"+"+diff,aColorIfBetter); } else { colorLabel(this.maxSpeedBoost,""+diff,aColorIfWorse); } int cost = aNewCar.carCost-aCurrentCar.carValue; this.carValue.text = cost.ToString("C0"); }
public void initFromCar(GTCar aCar) { carRef = aCar; if(researchRow==null) { initResearchRow(); } }
public void deselect(GTCar aCar) { carRef = aCar; getDefaultColourForPart(); }
public GTDriver getDriverFromCar(GTCar aCar) { int index = indexForCar(aCar); if(index>=0) { GTDriver driver = drivers[index]; return driver; } return null; }
public GTCar hasCar(GTCar aCar) { for(int i = 0;i<this.cars.Count;i++) { if(cars[i]==aCar) { return cars[i]; } } return null; }
public GTTeam getTeamFromCar(GTCar aCar) { for(int i = 0;i<teams.Count;i++) { GTCar car = teams[i].hasCar(aCar); if(car!=null) { return teams[i]; } } return null; }
public void initCar(GTCar aCar) { if(carTitle==null) { initLabels(); } GTTeam team = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam(); camController = GameObject.Find("Main Camera").GetComponent<GarageCameraController>(); carRef = aCar; this.showCar(aCar); this.showCarImprovements(); if(team.cars[0]==carRef) { camController.lookAtThis = GameObject.Find ("GarageLeftSide"); } else { camController.lookAtThis = GameObject.Find ("GarageRightSide"); } }
public void reInit(GTCar aLastCar) { buttonsHolder.gameObject.SetActive(true); this.initCar(aLastCar); }