public void LoadAnimalSave(LevelManager.AnimalSave save) { /* Loads animal with save info * Save info contains the last saved fur, clothing items, and animal stats * and gives them original position and rotation in Farm Scene */ name = save.animalName; animalID = save.animalID; animalType = save.animalType; pen = save.assignedPen; fur = FurManager.instance.furs[save.furID]; slot01 = ClothingManager.instance.clothes[save.slot01ClothID]; slot02 = ClothingManager.instance.clothes[save.slot02ClothID]; slot03 = ClothingManager.instance.clothes[save.slot03ClothID]; isFleeceGrown = save.isFurGrown; isHappy = save.animalIsHappy; animalClean = save.animalClean; animalFood = save.animalHunger; animalFurGrowth = save.animalFurGrowth; transform.position = save.position; transform.eulerAngles = save.rotation; }
/*------------------------------Animal Data Management----------------------------*/ public LevelManager.AnimalSave GetAnimalSave() { /* Add additional animal traits here * you must also add the new trait to the LevelManager.AnimalSave class as well */ LevelManager.AnimalSave newSave = new LevelManager.AnimalSave(); newSave.animalName = name; newSave.animalID = animalID; newSave.animalType = animalType; newSave.assignedPen = pen; newSave.furID = fur.furID; newSave.slot01ClothID = slot01.clothingID; newSave.slot02ClothID = slot02.clothingID; newSave.slot03ClothID = slot03.clothingID; newSave.isFurGrown = isFleeceGrown; newSave.animalIsHappy = isHappy; newSave.animalClean = animalClean; newSave.animalHunger = animalFood; newSave.animalFurGrowth = animalFurGrowth; newSave.position = transform.position; newSave.rotation = transform.eulerAngles; return(newSave); }
//set reference to Animal to apply UI actions to public void GetReferenceOfAnimalBeingInteractedWith(GameObject animalGameObject) { Debug.Log("Setting to reference: " + animalGameObject); animalReference = animalGameObject; animalStats = animalReference.GetComponent <Animal>(); animalSave = animalStats.GetAnimalSave(); animalName = animalStats.GetAnimalName(); }
void Start() { /*---Gets Animal component and the Animal Save for this animal that is customizeable---*/ animal = GetComponent <Animal>(); animalSave = animal.GetAnimalSave(); /*---If we are in the Farm scene, we look for the customizable button---*/ if (SceneManager.GetActiveScene() == SceneManager.GetSceneByName("Farm_test")) { customizeButton = GameObject.Find("Customize").GetComponent <Button>(); } }