예제 #1
0
	public void FirstTimeSetup()
	{
		Blob blob = new Blob();
		blob.male = true;
		blob.Hatch();
		blob.birthday = blob.birthday - gm.breedingAge;
		blob.SetRandomTextures();
		blob.id = gm.gameVars.blobsSpawned++;
		blob.SetGeneActivationForAll();
		blob.ApplyGeneEffects(blob.activeGenes);
		blob.sellValue = 10 + Mathf.FloorToInt(blob.level * 1.5f);
		blobs.Add(blob);
		
		blob = new Blob();
		blob.male = false;
		blob.Hatch();
		blob.birthday = blob.birthday - gm.breedingAge;
		blob.SetRandomTextures();
		blob.id = gm.gameVars.blobsSpawned++;
		blob.SetGeneActivationForAll();
		blob.ApplyGeneEffects(blob.activeGenes);
		blob.sellValue = 10 + Mathf.FloorToInt(blob.level * 1.5f);
		blobs.Add(blob);
	}
예제 #2
0
	public Blob GenerateNewBlobBasedOnBlobs(Blob dad, Blob mom)
	{
		Blob blob = new Blob();
		blob.id = gm.gameVars.blobsSpawned++;
		blob.dadId = dad.id;
		blob.momId = mom.id;
		blob.hasHatched = false;
		int totalEggs = GetTotalEggs();

		//safety spawn female
		if (GetTotalEggs() <= 0)
			blob.male = false;
		else
			blob.male = (UnityEngine.Random.Range(0, 2) == 0) ? true : false;
		
		blob.quality = Blob.GetRandomQuality();
		blob.level = (int)(dad.level + mom.level / 2f) + UnityEngine.Random.Range (-1,2);
		blob.level = Mathf.Clamp(blob.level, 1, 100);
		blob.sellValue = 10 + Mathf.FloorToInt(blob.level * 1.5f);
		blob.SetRandomTextures();

		List<Gene> parentGenesRaw = dad.genes.Union<Gene>(mom.genes).ToList<Gene>();
		List<Gene> GenesToPassOn = new List<Gene>();

		foreach(Gene g in parentGenesRaw)
		{
			int str = 0;
			if(dad.genes.Contains(g))
				str++;
			if(mom.genes.Contains(g))
				str++;

			float mod = (str > 1) ? .8f : .5f;

			float rand = UnityEngine.Random.Range(0f, 1f);
			if(rand < g.passOnChance * mod)
				GenesToPassOn.Add(g);
		}

		blob.unprocessedGenes = CleanupGeneList(GenesToPassOn);
		LimitGenesTo(blob, blob.allowedGeneCount);

		blob.SetGeneActivationForAll();
		blob.ApplyGeneEffects(blob.activeGenes);

		return blob;
	}
예제 #3
0
	public void GenerateVisitor()
	{
		Blob visitor = new Blob();

		visitor.male = true;
		visitor.Hatch();
		visitor.birthday = visitor.birthday - gm.breedingAge;
		visitor.level = gm.GetAverageLevel();
		visitor.quality = Blob.GetRandomQuality();
		visitor.SetRandomTextures();
		visitor.id = gm.gameVars.blobsSpawned++;
		gm.gameVars.visitorsSpawned++;

		List<Gene> goodGenes = GeneManager.GetGenesWithPositiveEffect(gm.mum.genes);
		List<Gene> badGenes = GeneManager.GetGenesWithNegativeEffect(gm.mum.genes);

		int allowedGenes = visitor.allowedGeneCount;

		for(int i=0; i<allowedGenes; i++)
		{
			Gene geneToadd = null;
			if((i%3) == 0)
			{
				geneToadd = GeneManager.GetRandomGeneBasedOnRarity(goodGenes);
				goodGenes.Remove(geneToadd);
			}
			else if(i==1)
			{
				geneToadd = badGenes[UnityEngine.Random.Range(0, badGenes.Count)];
				badGenes.Remove(geneToadd);
			}

			visitor.unprocessedGenes.Add(geneToadd);
		}

		if(gm.gameVars.visitorsSpawned == 1)
		{
			visitor.unprocessedGenes.Clear();
			visitor.unprocessedGenes.Add(gm.mum.GetGeneByName("Better Babies"));
		}

		if(gm.gameVars.visitorsSpawned == 2)
		{
			visitor.unprocessedGenes.Clear();
			visitor.unprocessedGenes.Add(gm.mum.GetGeneByName("Blue"));
		}

		if(gm.gameVars.visitorsSpawned == 3)
		{
			visitor.unprocessedGenes.Clear();
			visitor.unprocessedGenes.Add(gm.mum.GetGeneByName("Fertility"));
		}

		visitor.SetGeneActivationForAll();
		visitor.ApplyGeneEffects(visitor.activeGenes);

		visitors.Add(visitor);
		visitorCost.Add(gm.gameVars.visitorsSpawned * 50);
		visitorTimers.Add(DateTime.Now + new TimeSpan(0,1,0,0));

		gm.popup.Show("New Visitor", "A new Blob visitor has arrived to check out your kingdom!");
	}