Exemplo n.º 1
0
	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);
	}
Exemplo n.º 2
0
	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;
		}
	}
Exemplo n.º 3
0
	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);
		}
	}