コード例 #1
0
ファイル: RandomEvent.cs プロジェクト: cupsster/gtmanager
		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";
			
		
		
		}
コード例 #2
0
		public void FromString(string aString) {
			GTDriver.allDrivers = new List<GTDriver>();
			List<DriverLibraryRecord> availableDrivers = DriverLibrary.REF.drivers;
			for(int i = 0;i<availableDrivers.Count;i++) {
				availableDrivers[i].assignedTeam = 0;
			}
			GTDriver.allDrivers = new List<GTDriver>();

			ChampionshipSeason.ACTIVE_SEASON = (ChampionshipSeason) this;
			string[] split1 = aString.Split (new char[] {'%'});
			aString = split1[0];
			string[] split = aString.Split (new char[] {'|'});
			if(split.Length>1) {
				ChampionshipSeason.ACTIVE_SEASON.secondsPast = Convert.ToInt32(split[0]);
			}
			for(int i = 1;i<split.Length;i++) {
				ChampionshipSeasonLeague l = new ChampionshipSeasonLeague();
				if(split[i].Length>10) {
					l.FromString(split[i]);
					leagues.Add(l);
				}
			}
			split = split1[1].Split (new char[] {'|'});
			for(int i = 0;i<split.Length;i++) {
				if(split[i].Length>10) {
					GTDriver d = new GTDriver();
					d.FromString(split[i]);
				}
				
			}
			for(int i = 0;i<leagues.Count;i++) {
				leagues[i].postInit();
			}

			for(int i = 0;i<GTDriver.allDrivers.Count;i++) {
				GTDriver.allDrivers[i].initContract();
			}
		}
コード例 #3
0
		public ChampionshipSeasonLeague seasonForLeague(int aLeague) {
			for(int i = 0;i<leagues.Count;i++) {
				if(leagues[i].divisionNumber==aLeague) {
					return leagues[i];
				}
			}
			ChampionshipSeasonLeague newLeague = new ChampionshipSeasonLeague();
			newLeague.divisionNumber = aLeague;
			newLeague.initRaces();
			leagues.Add(newLeague);
			return newLeague;
		}
コード例 #4
0
ファイル: RandomEvent.cs プロジェクト: cupsster/gtmanager
		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;
			}
		}
コード例 #5
0
ファイル: RandomEvent.cs プロジェクト: cupsster/gtmanager
		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;
			}
		}
コード例 #6
0
ファイル: RandomEvent.cs プロジェクト: cupsster/gtmanager
		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;
			}
			
		}
コード例 #7
0
ファイル: RandomEvent.cs プロジェクト: cupsster/gtmanager
		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;
			}
		}