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


C# Blob.GetSpouse方法代码示例

本文整理汇总了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);
	}
开发者ID:mcdonnellv,项目名称:BlobsPrototype,代码行数:29,代码来源:NurseryManager.cs

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

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


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