public void UpdateBlobCellWithBlob(int index, Blob blob) { BlobCell bc = blobCells[index]; bc.blob = blob; if(blob == null) { bc.Reset(); bc.gameObject.SetActive(false); return; } bc.gameObject.SetActive(true); bc.egg.gameObject.SetActive(!blob.hasHatched); bc.body.gameObject.SetActive(blob.hasHatched); bc.face.gameObject.SetActive(blob.hasHatched); bc.cheeks.gameObject.SetActive(blob.hasHatched && !blob.male); if(!blob.hasHatched) bc.heart.gameObject.SetActive(false); UISprite bg = bc.GetComponent<UISprite>(); UIButton button = bc.GetComponentInChildren<UIButton>(); float c = 1.0f; bg.color = (blob.male) ? new Color(0.62f*c, 0.714f*c, 0.941f*c,1f) : new Color(0.933f*c, 0.604f*c, 0.604f*c, 1f); bg.color = (blob.hasHatched) ? bg.color : Color.grey; button.defaultColor = button.hover = bg.color; bc.qualityIndicator.color = (blob.hasHatched) ? Blob.ColorForQuality(blob.quality) : Color.clear; bc.eggLabel.text = (blob.male || !blob.hasHatched) ? "" : blob.unfertilizedEggs.ToString(); bc.eggIcon.gameObject.SetActive(blob.female && blob.hasHatched); // bc.geneIcon.gameObject.SetActive(blob.hasHatched); // bc.geneCountLabel.text = blob.genes.Count.ToString(); bc.levelLabel.text = (blob.hasHatched) ? ("lv. " + blob.level.ToString()) : ""; Texture tex = blob.bodyPartSprites["Body"]; bc.body.spriteName = tex.name; tex = blob.bodyPartSprites["Eyes"]; bc.face.spriteName = tex.name; bc.body.color = blob.color; int pixels = (int)(blob.BlobScale() * 50f); bc.body.SetDimensions(pixels, pixels); bc.face.SetDimensions(pixels, pixels); bc.cheeks.SetDimensions(pixels, pixels); bc.onMissionLabel.SetActive(blob.onMission); }
public void UpdateWithBlob(Blob blob) { theBlob = blob; if (blob == null) { UpdateAsNull(); return; } if (!blob.hasHatched) { UpdateAsEgg(); return; } blob.OrderGenes(); genePanel.gameObject.SetActive(false);//blob.hasHatched); hatchButton.gameObject.SetActive(false); addEggButton.gameObject.SetActive(theBlob.female); breedButton.gameObject.SetActive(true); moveButton.gameObject.SetActive(true); deleteButton.gameObject.SetActive(true); progress.gameObject.SetActive(false); body.gameObject.SetActive(true); face.gameObject.SetActive(true); cheeks.gameObject.SetActive(!blob.male); egg.gameObject.SetActive(false); Texture tex = blob.bodyPartSprites["Body"]; body.spriteName = tex.name; tex = blob.bodyPartSprites["Eyes"]; face.spriteName = tex.name; body.color = blob.color; bg.color = (blob.male) ? new Color(0.62f, 0.714f, 0.941f,1f) : new Color(0.933f, 0.604f, 0.604f, 1f); eggsLabel.text = blob.unfertilizedEggs.ToString() + " eggs left"; qualityLabel.text = blob.quality.ToString() + " quality"; levelLabel.text = "Level " + blob.level.ToString(); if (blob.male) { genderLabel.text = "Male"; eggsLabel.text = ""; } else genderLabel.text = "Female"; int pixels = (int)(blob.BlobScale() * 50f); body.SetDimensions(pixels, pixels); face.SetDimensions(pixels, pixels); cheeks.SetDimensions(pixels, pixels); //UpdateGenePanel() UpdateBreedButton(blob); moveButton.isEnabled = false; bool isIdle = blob.GetBlobStateString() == ""; moveButton.isEnabled = false; deleteButton.isEnabled = isIdle; addEggButton.isEnabled = !isIdle ? false : addEggButton.isEnabled; UpdateSellValue(); }