public int indexOfSponsor(SponsorRecord aRecord) {
			for (int i  = 0; i<sponsors.Count; i++) {
				if(sponsors[i]==aRecord) {
					return i;
				}
			}
			return -1;
		}
		public SponsorPlacedRelationshipRecord (ESponsorPosition aSponsor,SponsorRecord aRecord,float aValuePerRace,int aRacesRemaining) : base(aRecord,0)
		{
		
			position = aSponsor;
			remaining = aRacesRemaining;
			valuePerRace = aValuePerRace;
			
		}
	public SponsorRelationshipRecord (int aID,int aRelationshipValue)
	{
		for(int i = 0;i<SponsorDatabase.REF.sponsors.Count;i++) {
			if(SponsorDatabase.REF.sponsors[i].id==aID) {
				this.record = SponsorDatabase.REF.sponsors[i];
				break;
			}
		}
		this.currentRelationshipValue = aRelationshipValue;
	}
		public SponsorRelationshipRecord sponsorRelationship(SponsorRecord aRecord) {
			for(int i= 0;i<sponsorRelationships.Count;i++) {
				if(sponsorRelationships[i].record==aRecord) {
					return sponsorRelationships[i];
				}
			}
			return null; 
		}
		public SponsorInterestInfo interestFromSponsor(SponsorRecord aSponsor) {
			for(int i = 0;i<this.sponsorRelationships.Count;i++) {
				if(sponsorRelationships[i].record==aSponsor) {
					return sponsorRelationships[i].interest;
				}
			}
			return null;
		}
	public void init(SponsorRecord aRecord,int aRelationshipValue)
	{
		record = aRecord;
		currentRelationshipValue = aRelationshipValue - record.requiredReputation;
	}
	public SponsorRelationshipRecord (SponsorRecord aRecord,int aRelationshipValue)
	{
		init(aRecord,aRelationshipValue);
	}
Exemple #8
0
	public void showSponsor(SponsorRecord aSponsor) {
			if(companyTitle==null) {
				initLabels();
			} 
			/*
				
				switch(sprites[i].name) {
					case("SponsorTop"):
						rec = hasSponsorForPlace(ESponsorPosition.Bonnet);break;
					case("SponsorRoof"):
						rec = hasSponsorForPlace(ESponsorPosition.Roof);break;
					case("SponsorRightSide"):
						rec = hasSponsorForPlace(ESponsorPosition.Right);break;
					case("SponsorLeftSide"):
						rec = hasSponsorForPlace(ESponsorPosition.Left);break;
					case("SponsorBackside"):
						rec = hasSponsorForPlace(ESponsorPosition.Back);break;
				}
*/
			GTTeam myTeam = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam();
			GameObject thisCar = this.getCameraPositionsFromThis.GetComponent<GarageCarManager>().thisCarsGameObject;
			SpriteRenderer[] sponsorRenderers = thisCar.GetComponentsInChildren<SpriteRenderer>();
			string wantToLookAtThis = "";
			GameObject lookAtThis = null;
			switch(this.currentPosition) {
				case(ESponsorPosition.Back):
					positionLabel.text = "Back";
			
					this.mainCamera.gameObject.transform.position = this.getCameraPositionsFromThis.transform.FindChild("CameraBack").position;
					wantToLookAtThis = "SponsorBackside";
				break;
				case(ESponsorPosition.Bonnet):
					positionLabel.text = "Front";
					this.mainCamera.gameObject.transform.position = this.getCameraPositionsFromThis.transform.FindChild("CameraFront").position;
					wantToLookAtThis = "SponsorTop";
			break;
				case(ESponsorPosition.Left):
					positionLabel.text = "Left Side";
					this.mainCamera.gameObject.transform.position = this.getCameraPositionsFromThis.transform.FindChild("CameraRight").position;
					wantToLookAtThis = "SponsorLeftSide";
			break;
				case(ESponsorPosition.Right):
					positionLabel.text = "Right Side";
					this.mainCamera.gameObject.transform.position = this.getCameraPositionsFromThis.transform.FindChild("CameraLeft").position;
					wantToLookAtThis = "SponsorRightSide";
			break;	
				case(ESponsorPosition.Roof):
					positionLabel.text = "Top";
					this.mainCamera.gameObject.transform.position = this.getCameraPositionsFromThis.transform.FindChild("CameraTop").position;
					wantToLookAtThis = "SponsorRoof";
					break;		
		}

		for(int i = 0;i<sponsorRenderers.Length;i++) {
			if(sponsorRenderers[i].name==wantToLookAtThis) {
				lookAtThis = sponsorRenderers[i].gameObject;
			}
		}
		this.mainCamera.GetComponent<GarageCameraController>().desiredFieldOfView = 90f;
		this.mainCamera.GetComponent<GarageCameraController>().lookAtThis = lookAtThis;
		if(myTeam.hasSponsorForPlace(this.currentPosition)!=null) {
				SponsorPlacedRelationshipRecord recRecord = myTeam.hasSponsorForPlace(this.currentPosition);
				sponsorDescription.text = "Sponsored by "+recRecord.record.name+" for $"+recRecord.valuePerRace+" Per Race for "+recRecord.remaining+" more race(s)";
				showingSponsor = SponsorDatabase.REF.indexOfSponsor(recRecord.record);
				companyTitle.text = recRecord.record.name;
				companySprite.sprite2D = recRecord.record.logo;
				
				contractLength.text = ""+recRecord.remaining+" Races";
				this.contractValue.text = ""+recRecord.valuePerRace;
				this.sponsorInterest.text = "Sponsored";
				this.acceptButton.isEnabled = false;
				this.rightButton.isEnabled = false;
				this.leftButton.isEnabled = false;
				
		} else {
				showingSponsor = SponsorDatabase.REF.indexOfSponsor(aSponsor);
				companySprite.sprite2D = aSponsor.logo;
				GTTeam team = ChampionshipSeason.ACTIVE_SEASON.getUsersTeam();
				SponsorInterestInfo sii = team.interestFromSponsor(aSponsor);
				companyTitle.text = aSponsor.name;
			
				this.rightButton.isEnabled = true;
				this.leftButton.isEnabled = true;
				sponsorDescription.text = aSponsor.description;
				sponsorInterestInfo = sii;
				contractLength.text = ""+sii.contractLength+" Races";
				this.contractValue.text = ""+sii.sponsorValue;
				this.sponsorInterest.text = ""+sii.sponsorInterestString;
				if(sii.sponsorValue>0f) {
					this.acceptButton.isEnabled = true;
				} else {
					this.acceptButton.isEnabled = false;
				}
			}
		}