本文整理汇总了C#中Blob.GetSpouse方法的典型用法代码示例。如果您正苦于以下问题:C# Blob.GetSpouse方法的具体用法?C# Blob.GetSpouse怎么用?C# Blob.GetSpouse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blob
的用法示例。
在下文中一共展示了Blob.GetSpouse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BreedBlobWithSpouse
public void BreedBlobWithSpouse(Blob blob)
{
if(blob.spouseId == -1)
{gm.popup.Show("Cannot Breed", "Blob has no mate."); return;}
if(gm.gold < GetBreedCost())
{gm.popup.Show("Cannot Breed", "Not enough gold.");return;}
if(blobs.Count >= maxBlobs)
{gm.popup.Show("Cannot Breed", "Room is full.");return;}
if(blob.breedReadyTime > System.DateTime.Now)
{gm.popup.Show("Cannot Breed", "Blob is still breeding");return;}
if(blob.heartbrokenRecoverTime > System.DateTime.Now)
{gm.popup.Show("Cannot Breed", "Blob is depressed");return;}
Blob spouse = blob.GetSpouse();
if((blob.female && blob.unfertilizedEggs == 0) || (spouse.female && spouse.unfertilizedEggs == 0))
{gm.popup.Show("Cannot Breed", "Female Blob cannot produce anymore eggs.\nThis Blob must find a new mate to be able to breed.");return;}
gm.AddGold(-GetBreedCost());
if(blob.male)
BreedBlobs(blob, spouse);
else
BreedBlobs(spouse, blob);
infoPanel.UpdateWithBlob(blob);
}
示例2: GetMateFindResult
public void GetMateFindResult(Blob blob)
{
if(blob.female)
return;
Blob spouse = blob.GetSpouse();
int levelDifference = Mathf.Clamp(spouse.level - blob.level, 0, 100);
float penalty = Mathf.Clamp(levelDifference * .1f, 0f, 1f);
float roll = UnityEngine.Random.Range(0f,1f);
bool success = (roll < (1f - penalty));
if(success)
{
//gm.blobPopup.Show(spouse, "Find a Partner", "Blobs have successfuly patnered!\nThey can now breed.");
BlobCell bc = gm.nm.blobPanel.blobCells[gm.nm.blobs.IndexOf(blob)];
bc.heart.gameObject.SetActive(true);
bc = gm.nm.blobPanel.blobCells[gm.nm.blobs.IndexOf(spouse)];
bc.heart.gameObject.SetActive(true);
}
else
{
gm.blobPopup.Show(blob, "Find a Partner", "Partnering failed. These blobs had trouble getting along.");
blob.heartbrokenRecoverTime = System.DateTime.Now + blob.heartbrokenRecoverDelay;
blob.spouseId = -1;
spouse.spouseId = -1;
}
}
示例3: RemoveSpouse
public void RemoveSpouse(Blob blob)
{
Blob spouse = blob.GetSpouse();
if(spouse == null)
blob.spouseId = -1;
else
{
blob.spouseId = -1;
spouse.spouseId = -1;
blob.heartbrokenRecoverTime = System.DateTime.Now + blob.heartbrokenRecoverDelay;
spouse.heartbrokenRecoverTime = System.DateTime.Now + spouse.heartbrokenRecoverDelay;
BlobCell bc = blobPanel.blobCells[blobs.IndexOf(blob)];
bc.heart.gameObject.SetActive(false);
bc = blobPanel.blobCells[blobs.IndexOf(spouse)];
bc.heart.gameObject.SetActive(false);
infoPanel.UpdateWithBlob(blob);
}
}