本文整理匯總了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);
}
}