當前位置: 首頁>>代碼示例>>C#>>正文


C# Blob.Hatch方法代碼示例

本文整理匯總了C#中Blob.Hatch方法的典型用法代碼示例。如果您正苦於以下問題:C# Blob.Hatch方法的具體用法?C# Blob.Hatch怎麽用?C# Blob.Hatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Blob的用法示例。


在下文中一共展示了Blob.Hatch方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FirstTimeSetup

	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);
	}
開發者ID:mcdonnellv,項目名稱:BlobsPrototype,代碼行數:24,代碼來源:NurseryManager.cs

示例2: GenerateVisitor

	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!");
	}
開發者ID:mcdonnellv,項目名稱:BlobsPrototype,代碼行數:62,代碼來源:VisitorManager.cs


注:本文中的Blob.Hatch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。