void GenerateRandomObject(int level = Constant.LEVEL_1) { FoodController.FoodType foodType = DelegateManager.GetRandomFoodType(); FoodController fController = DelegateManager.GetFood(foodType); fController.IsUsed = true; PetIconController.PetType petType = DelegateManager.GetRandomPetType(level); PetIconController piController = DelegateManager.GetPetIcon(level, petType); piController.IsUsed = true; BaseObject controller = GetObjectInPool(); controller.ActivateBaseObject(true); controller.LinkFoodAndPetIcon(ref fController, ref piController); controller.ActivateFoodAndPetIcon(true); //controller.FDController = fController; //controller.PIController = piController; controller.UpdateObjectState(BaseObject.ObjectState.CanMoved); m_ListObjects.Add(controller); //Update position in here now + update last object reference Vector3 newPos = new Vector3(m_LastObject.GetTransformation().position.x + m_Offset, m_PosY, 0); controller.UpdatePositionInWorld(newPos); m_LastObject = controller; }
BaseObject GetRequiredBaseOjbect(int level, PetIconController.PetType petType, FoodController.FoodType foodType) { FoodController fController = DelegateManager.GetFood(foodType); fController.IsUsed = true; PetIconController piController = DelegateManager.GetPetIcon(level, petType); piController.IsUsed = true; BaseObject obj = GetObjectInPool(); obj.ActivateBaseObject(true); obj.LinkFoodAndPetIcon(ref fController, ref piController); obj.ActivateFoodAndPetIcon(true); //obj.FDController = fController; //obj.PIController = piController; return(obj); }
void CreateListObjects(int level = Constant.LEVEL_1) { for (int i = 0; i < Constant.NUMBER_OBJECTS; ++i) { FoodController.FoodType foodType = DelegateManager.GetRandomFoodType(); FoodController fController = DelegateManager.GetFood(foodType); fController.IsUsed = true; PetIconController.PetType petType = DelegateManager.GetRandomPetType(level); PetIconController piController = DelegateManager.GetPetIcon(level, petType); piController.IsUsed = true; BaseObject controller = GetObjectInPool(); //controller.FDController = fController; //controller.PIController = piController; controller.ActivateBaseObject(true); controller.LinkFoodAndPetIcon(ref fController, ref piController); controller.ActivateFoodAndPetIcon(true); m_ListObjects.Add(controller); } }