当前位置: 首页>>代码示例>>C#>>正文


C# Blob.SetRandomTextures方法代码示例

本文整理汇总了C#中Blob.SetRandomTextures方法的典型用法代码示例。如果您正苦于以下问题:C# Blob.SetRandomTextures方法的具体用法?C# Blob.SetRandomTextures怎么用?C# Blob.SetRandomTextures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Blob的用法示例。


在下文中一共展示了Blob.SetRandomTextures方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: GenerateNewBlobBasedOnBlobs

	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;
	}
开发者ID:mcdonnellv,项目名称:BlobsPrototype,代码行数:47,代码来源:NurseryManager.cs

示例3: 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.SetRandomTextures方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。