bool IsPlaying(GameConstants.eBabies _babyType) { foreach (Baby baby in currentBabies) { if (baby && baby.baby == _babyType) { return(true); } } return(false); }
public Prize GetPrize(GameConstants.eBabies _babyType) { foreach (Prize prize in prizes) { if (prize.foodType == _babyType && prize.transform.parent == transform) { prize.gameObject.SetActive(true); return(prize); } } return(null); }
public Food GetFood(GameConstants.eBabies _babyType) { foreach (Food f in food) { if (f.foodType == _babyType && f.transform.parent == transform) { f.gameObject.SetActive(true); return(f); } } return(null); }
public Baby GetBaby(GameConstants.eBabies _babyType) { foreach (Baby baby in babies) { if (baby.baby == _babyType && baby.transform.parent == transform) { baby.gameObject.SetActive(true); return(baby); } } return(null); }
public BabyData GetBabyData(GameConstants.eBabies _babyType) { foreach (BabyData data in babyData) { if (data.BabyType == _babyType) { return(data); } } //Error Debug.LogError("ERROR: GetBabyData"); return(null); }
void SetBabiesAndFood() { //Set babies for (int i = 0; i < NumBabies[currentLevel]; ++i) { if (currentBabies[i] == null) { //Get random baby GameConstants.eBabies babyType = GetRandomBabyType(); currentBabies[i] = BabiesPool.Instance.GetBaby(babyType); currentBabies[i].Idle(); //Link a cloud int cloudLinkIndex = GetCloudLinkIndex(i); currentClouds[cloudLinkIndex] = CloudPool.Instance.GetCloud(); currentClouds[cloudLinkIndex].transform.parent = null; //Link baby to cloud currentBabies[i].transform.parent = currentClouds[cloudLinkIndex].babyLink; currentBabies[i].transform.localPosition = Vector3.zero; if (cloudLinkIndex == 0) { currentClouds[cloudLinkIndex].transform.localScale = new Vector3(-1, 1, 1); } currentClouds[cloudLinkIndex].SetPos(cloudLinkIndex == 0 ? Pos_LeftOut : cloudLinkIndex == 1 ? Pos_CenterOut : Pos_RightOut); currentClouds[cloudLinkIndex].MoveTo(cloudLinkIndex == 0 ? Pos_LeftIn : cloudLinkIndex == 1 ? Pos_CenterIn : Pos_RightIn, 0.2f); } } //Set food GameConstants.eBabies foodType; if (NumBabies[currentLevel] <= 1) { foodType = currentBabies[0].baby; } else { foodType = GetRandomFoodType(); } currentFood = BabiesPool.Instance.GetFood(foodType); currentFood.transform.parent = null; currentFood.transform.localScale = Vector3.one; currentFood.gameObject.SetActive(true); currentFood.SetPos(Pos_FoodInit); currentFood.MoveTo(Pos_FoodIn, 0.15f); }