コード例 #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 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!");
	}