本文整理汇总了C#中Blob.ApplyGeneEffects方法的典型用法代码示例。如果您正苦于以下问题:C# Blob.ApplyGeneEffects方法的具体用法?C# Blob.ApplyGeneEffects怎么用?C# Blob.ApplyGeneEffects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blob
的用法示例。
在下文中一共展示了Blob.ApplyGeneEffects方法的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);
}
示例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;
}
示例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!");
}