Exemplo n.º 1
0
		public void FromString(string aString) {
			string decode = Base64.Base64Decode(aString);
			string[] split = decode.Split(new char[] {'|'});
			if(split.Length==2) {
				carLibRecord = CarDatabase.REF.carRecordByID(Convert.ToInt32(split[0]));
				string rnd = Base64.Base64Decode(split[1]);
				string[] rndSplit = rnd.Split(new char[] {'%'});
				for(int i = 0;i<rndSplit.Length;i++) {
					string[] part = rndSplit[i].Split(new char[] {'|'});
					if(part.Length==5) {
						GTEquippedResearch research = new GTEquippedResearch(Convert.ToInt32(part[0]),Convert.ToInt32(part[1]),Convert.ToInt32(part[2]),Convert.ToInt32(part[3]),Convert.ToInt32(part[4]));
						this.rndParts.Add(research);
					}
				}
			}
			
		}
Exemplo n.º 2
0
	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);
		}
	}
Exemplo n.º 3
0
		public GTCar(string aCarName)
		{
			carLibRecord = CarDatabase.REF.carByName (aCarName);
		}
Exemplo n.º 4
0
		public void replaceCarAI(CarLibraryRecord aCar) {
			carLibRecord = aCar;
		}
Exemplo n.º 5
0
		public void replaceCar(CarLibraryRecord aCar) {
			carLibRecord = aCar;
			rndParts = new List<GTEquippedResearch>();
		}
Exemplo n.º 6
0
	public void showCar(CarLibraryRecord aRecord) {		
		if(carTitle==null) {
			initLabels();
		}

		this.carTitle.text = ""+aRecord.name;
		horsepowerValue.text = ""+aRecord.carHP;
		torqueValue.text = ""+aRecord.carTorque;
		this.turboValue.text = "0";
		nitroValue.text = ""+aRecord.maxNitro;
		shiftspeedValue.text = ""+aRecord.carShiftSpeed;
		this.dragValue.text = ""+aRecord.carDragString+" ("+aRecord.carDrag+")";
		this.maxSpeedValue.text = ""+aRecord.carMaxSpeed+"MPH";
		gripValue.text = ""+aRecord.carTireWearEffect;
		this.hasDRSValue.text = "Level 0";
		
		this.carValue.text = ""+aRecord.carCost.ToString("C0");
		GTTeam team = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam();
		GTDriver driver = team.getDriverFromCar(this.carRef);
		if(driver!=null) {
			this.carTitle.text = driver.name+"'s "+aRecord.name;
		}
	}
Exemplo n.º 7
0
	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");
	}
Exemplo n.º 8
0
		public void showCar(int aCarIndex) {
			if(carOnSale!=null) {
				Destroy(carOnSale.gameObject);
				carOnSale = null;
			}
			if(aCarIndex>=CarDatabase.REF.cars.Count) {
				aCarIndex = 0;
			}
			if(aCarIndex<0) {
				aCarIndex = CarDatabase.REF.cars.Count-1;
			}
			currentIndex = aCarIndex;
			car = CarDatabase.REF.cars[aCarIndex];
			GameObject c = car.carPrefab;
			
			parent = GameObject.Find ("GarageManager").transform.FindChild("GarageCenter").gameObject;
			GameObject thisCar = GameObject.Instantiate(c);
			//	thisCar.transform.SetParent(parent.transform);
			thisCar.transform.position = parent.transform.position;
			thisCar.GetComponent<RacingAI>().initSmokes();
			thisCar.GetComponent<RacingAI>().hidePilot();
			SpriteRenderer[] renderers = thisCar.GetComponentsInChildren<SpriteRenderer>();
			for(int i = 0;i<renderers.Length;i++) {			
				Destroy(renderers[i].gameObject);
			}
			GTTeam myTeam = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam();

			if(car.leagueRequired>=ChampionshipSeason.ACTIVE_SEASON.leagueForTeam(myTeam).divisionNumber) {
				
				if((car.upgradeRequired==2&&SaveGameUtils.fullGameOwned==2)||(car.upgradeRequired<2)) {
					this.lblDivisionLabel.gameObject.SetActive(false);
					this.centerLight.gameObject.SetActive(true);
					btnBuyCar.isEnabled = true;
				} else if(car.upgradeRequired==2) {
					
					lblDivisionLabel.text = "Full Game Plus Pack Required";
					this.lblDivisionLabel.gameObject.SetActive(true);
					this.centerLight.gameObject.SetActive(false);
					btnBuyCar.isEnabled = false;
				}
			} else {
				lblDivisionLabel.text = "League "+car.leagueRequired+" Required";
				this.lblDivisionLabel.gameObject.SetActive(true);
				this.centerLight.gameObject.SetActive(false);
				btnBuyCar.isEnabled = false;
				
			}
//thisCar.GetComponent<RacingAI>()
			carOnSale = thisCar;
			deleteIRDSClasses(carOnSale);
			this.GetComponent<CarDetails>().showCar (car);
			this.GetComponent<CarDetails>().compareCarTo(car,_carToReplace,this.colorIfCarBetter,this.colorIfCarWorse);

		}