Ejemplo n.º 1
0
		public void setupForToxicDriver(GTTeam aMyTeam,ChampionshipSeasonLeague aLeague) {
			int driverToBoost = UnityEngine.Random.Range(0,1);
			GTDriver driver = aMyTeam.drivers[driverToBoost];
			
			float amountToAdd = UnityEngine.Random.Range(0.5f,1.5f)*-1;
			if(GTDriver.percentOfGoodnessSponsorValue(driver.sponsorFriendliness+amountToAdd)<1f) {
				driver.sponsorFriendliness += amountToAdd;
				aMyTeam.multiplySponsorRelationships(0.5f);
			} else {
				failed = true;
			}
			DialogueLua.SetVariable("RandomEventDriver",driver.name);
			this.startConversation = "RandomEventDriverToxic";
			
		
		
		}
Ejemplo n.º 2
0
	public void initTeam(GTTeam aTeam) {
		if(positionLabel==null) {
			UILabel[] childLabels = this.GetComponentsInChildren<UILabel>();
			for(int i = 0;i<childLabels.Length;i++) {
				if(childLabels[i].gameObject.name=="FinisherPosition") {
					positionLabel = childLabels[i];
				}
				if(childLabels[i].gameObject.name=="FinisherName") {
					nameLabel = childLabels[i];
				}
				if(childLabels[i].gameObject.name=="FinisherDetail") {
					prizeInfo = childLabels[i];
				}
			}
		}

		this.nameLabel.text = aTeam.teamName;
		this.prizeInfo.text = ""+aTeam.seasonPoints;
	}
Ejemplo n.º 3
0
		public GTEquippedResearch addPartToCar(RnDRow aRow,GTTeam aTeam) {
		//	if(aRow._par
			for(int i = 0;i<rndParts.Count;i++) {
				if(this.hasPreRequisiteParts(aRow._partprerequisites)) {
					if(rndParts[i].researchRow==aRow) {
						if(rndParts[i].level<aRow._maxlevelstounlock) {
							rndParts[i].level++;
							return rndParts[i];
						} else {
							return null;
						}
					}
				}
			}
			if(this.hasPreRequisiteParts(aRow._partprerequisites)) {
				rndParts.Add(new GTEquippedResearch(aRow));
				return rndParts[rndParts.Count-1];
			} else {
				return null;
			}
		}
Ejemplo n.º 4
0
		public ChampionshipSeasonLeague seasonForTeam(GTTeam aTeam) {
			for(int i = 0;i<leagues.Count;i++) {
				if(leagues[i].hasTeam(aTeam)!=null) {
					return leagues[i];
				}
			}
			return null;
		}
Ejemplo n.º 5
0
		public void teamsFromString(string aString) {
			string uncomp = Base64.Base64Decode(aString);
			string[] split = uncomp.Split(new char[] {'|'});
			for(int i =0;i<split.Length;i++) {
				GTTeam team = new GTTeam();
				if(split[i].Length>5) {
					team.FromString(split[i]);
					this.teams.Add(team);
				}
			}
		}
Ejemplo n.º 6
0
		public int sortOnChampsPoints(GTTeam aTeam1,GTTeam aTeam2) {
			if(aTeam1.seasonPoints>aTeam2.seasonPoints) {
				return -1;
			} else if(aTeam2.seasonPoints>aTeam1.seasonPoints) {
				return 1;
			} else if(aTeam1.seasonWins>aTeam2.seasonWins) {
				return -1;
			} else if(aTeam2.seasonWins>aTeam1.seasonWins) {
				return 1;
			} else {
				return 0;
			}
		}
Ejemplo n.º 7
0
		public int positionForTeamInChampionship(GTTeam aTeam) {
			int lastPosition = -1;
			int lastPoints = -1;
			int lastWins = -1;
		
			List<GTTeam> sort1 = this.sortedTeams;
			for(int i = 0;i<sort1.Count;i++) {
				if(lastPosition==-1) {
					lastPosition = 0;
					lastPoints = sort1[i].seasonPoints;
					lastWins = sort1[i].seasonWins;
				} else {
					if(sort1[i].seasonPoints==lastPoints&&sort1[i].seasonWins==lastWins) {

					} else {
						lastPosition++;
					}
				}
				if(sort1[i]==aTeam) {
					return lastPosition;
				}
			}
			return 0;
		}
Ejemplo n.º 8
0
		public void setupForResearchLeaked(GTTeam aMyTeam,ChampionshipSeasonLeague aLeague) {
			int carToStealFrom = UnityEngine.Random.Range(0,1);
			int totalRnDParts = aMyTeam.cars[carToStealFrom].rndParts.Count;
			if(totalRnDParts>0) {
				int partToSteal = UnityEngine.Random.Range(0,totalRnDParts);
			
				GTEquippedResearch r = aMyTeam.cars[carToStealFrom].rndParts[partToSteal];
				if(aLeague.giveResearchToAllTeams(r)) {
					researchItem = r;
					startConversation = "RandomEventResearchLeaked";
				} else {
					failed = true; 
				}
			} else {
				failed = true;
			}
			
		}
Ejemplo n.º 9
0
		public void addTeam(GTTeam aTeamToAdd) {
			aTeamToAdd.ignoreFromRelegationAndPromotion = true;
			teams.Add(aTeamToAdd);
		}
Ejemplo n.º 10
0
		public GTTeam hasTeam(GTTeam aTeam) {
			for(int i = 0;i<teams.Count;i++) {
				if(teams[i]==aTeam) {
					return teams[i];
				}
			}
			return null;
		}
Ejemplo n.º 11
0
		public GTTeam findTeam1AboveOrBelow(GTTeam aTeam) {
			
			List<GTTeam> teams1 = sortedTeams;
			int positionForTeam = this.positionForTeamInChampionship(aTeam);
			if(positionForTeam==0) {
				return teams1[positionForTeam+1];
			} else {
				return teams1[positionForTeam-1];
			}
		}
Ejemplo n.º 12
0
	public void initTeam(GTTeam aTeam) {
		this.nameLabel.text = aTeam.teamName;
		this.prizeInfo.text = ""+aTeam.seasonPoints;
	}
Ejemplo n.º 13
0
		public void setupForDriverImprovement(GTTeam aMyTeam,ChampionshipSeasonLeague aLeague) {
			int driverToBoost = UnityEngine.Random.Range(0,1);
			GTDriver driver = aMyTeam.drivers[driverToBoost];

			int areaToChange = UnityEngine.Random.Range(0,5);
			
			switch(areaToChange) {
				// Cornering
				default:failed = true;
				break;
				case(0):float amountToAdd = UnityEngine.Random.Range(0.05f,0.3f);
						if(GTDriver.percentOfGoodnessCorneringValue(driver.corneringSpeedFactor+amountToAdd)<1f) {
							driver.corneringSpeedFactor += amountToAdd;
						} else {
							failed = true;
						}
						DialogueLua.SetVariable("RandomEventDriverImprovement","Cornering Speed");
						DialogueLua.SetVariable("RandomEventDriver",driver.name);
						this.startConversation = "RandomEventDriverImprovement";
						break;
				case(1):
					amountToAdd = UnityEngine.Random.Range(0.05f,0.3f)*-1;
					if(GTDriver.percentOfGoodnessBrakingValue(driver.aggressivenessOnBrake+amountToAdd)<1f) {
						driver.aggressivenessOnBrake += amountToAdd;
					} else {
						failed = true;
					}
					DialogueLua.SetVariable("RandomEventDriverImprovement","Braking Aggression");
					DialogueLua.SetVariable("RandomEventDriver",driver.name);
					this.startConversation = "RandomEventDriverImprovement";
					break;
				case(2):
					amountToAdd = UnityEngine.Random.Range(0.001f,0.01f)*-1;
					if(GTDriver.percentOfGoodnessErrorValue(driver.humanError+amountToAdd)<1f) {
						driver.humanError += amountToAdd;
					} else {
						failed = true;
					}
					DialogueLua.SetVariable("RandomEventDriverImprovement","Reliability");
					DialogueLua.SetVariable("RandomEventDriver",driver.name);
					this.startConversation = "RandomEventDriverImprovement";
					break;
				case(3):
					amountToAdd = UnityEngine.Random.Range(0.5f,1f)*-1;
					if(GTDriver.percentOfGoodnessOvertakingValue(driver.overtakeSpeedDifference+amountToAdd)<1f) {
						driver.overtakeSpeedDifference += amountToAdd;
					} else {
						failed = true;
					}
					DialogueLua.SetVariable("RandomEventDriverImprovement","Overtaking");
					DialogueLua.SetVariable("RandomEventDriver",driver.name);
					this.startConversation = "RandomEventDriverImprovement";
					break;
				case(4):
					amountToAdd = UnityEngine.Random.Range(0.5f,1f);
					if(GTDriver.percentOfGoodnessSponsorValue(driver.sponsorFriendliness+amountToAdd)<1f) {
						driver.sponsorFriendliness += amountToAdd;
					} else {
						failed = true;
					}
					DialogueLua.SetVariable("RandomEventDriverImprovement","Sponsor Friendliness");
					DialogueLua.SetVariable("RandomEventDriver",driver.name);
					this.startConversation = "RandomEventDriverImprovement";
					break;
			}
		}
Ejemplo n.º 14
0
		public void setupForFinishAheadOf(GTTeam aMyTeam,ChampionshipSeasonLeague aLeague) {
			GTTeam team = aLeague.findTeam1AboveOrBelow(aMyTeam);
			this.targetTeam = team;
			if(ChampionshipSeason.ACTIVE_SEASON.nextRace!=null) {
			this.targetDate = ChampionshipSeason.ACTIVE_SEASON.nextRace.startDate;
			this.alertMessage = "Score more points in the race than "+team.teamName;
			raceStartBehaviour = ERaceStartEventBehaviour.Alert;
			startConversation = "RandomEventFinishAheadOf";
			rewardCash = UnityEngine.Random.Range(1000,aMyTeam.cash);
			if(rewardCash>aMyTeam.cash) {
				rewardCash = aMyTeam.cash;
			}
			rewardCash = (rewardCash/1000)*1000;
			this.wonAlert = "You scored more than "+team.teamName+" and win "+rewardCash.ToString("C0")+"!";
			this.lostAlert = "You failed to score more than "+team.teamName+" and lose "+rewardCash.ToString("C0")+"!";
			} else {
				failed = true;
			}
		}
Ejemplo n.º 15
0
	private int pointsForTeamInRace(GTTeam aTeam) {
		int r = 0;
		for(int i =0;i<this.finishers.size;i++) {
			if(ChampionshipSeason.ACTIVE_SEASON.getTeamFromDriver(finishers[i].driverRecord)==aTeam) {
				r+= finishers[i].finishPoints;
			}
		}
		return r;
	}
Ejemplo n.º 16
0
		public void removeTeam(GTTeam aTeamToRemove) {
			aTeamToRemove.ignoreFromRelegationAndPromotion = true;
			teams.Remove(aTeamToRemove);
		}
Ejemplo n.º 17
0
	public void recolourCarForTeam(GTTeam aTeam) {
		MeshRenderer[] ms = this.GetComponentsInChildren<MeshRenderer>();
		//	Debug.Log (ms[0].material.shader.name+" on "+this.gameObject.name);
		for(int i = 0;i<ms.Length;i++) 
			if(ms[i].material.shader.name.Contains("Car Paint")||ms[i].material.shader.name.Contains("Chrome")) {
				if(ms[i].gameObject.name.ToLower().Contains("wheel")) {
					ms[i].material.SetColor("_Color",aTeam.wheelColor);
				} else
				ms[i].material.SetColor("_Color",aTeam.teamColor); 
			}
			else {
			//			Debug.Log (ms[i].material.shader.name);
		} 
	}
Ejemplo n.º 18
0
		public void setupForResearchBreakthrough(GTTeam aMyTeam,ChampionshipSeasonLeague aLeague) {
			int carToBoostResearch = UnityEngine.Random.Range(0,1);
			GTCar car = aMyTeam.cars[carToBoostResearch];
			if(car.partBeingResearched!=null) {
				car.partBeingResearched.dayOfCompletion = ChampionshipSeason.ACTIVE_SEASON.secondsPast+1;
				car.partBeingResearched.daysOfResearchRemaining = 1;
				researchItem = car.partBeingResearched;
				startConversation = "RandomEventResearchComplete";
			} else {
				failed = true;
			}
		}