/// <summary> /// Updates the pet's form, using this class's current place in the pet /// form tree. /// </summary> public void advancePetForm() { Instantiate(EvoParticles, transform.position + new Vector3(0.0f, 0.0f, -1f), Quaternion.Euler(90f, 0f, 0f)); if (currentPetFormNode.nextForms.Count == 0) { return; } // check which form the pet is in the neediness bounds for float current_neediness = petStatus.getNeediness(); foreach (PetFormBranch branch in currentPetFormNode.nextForms) { float minBound = branch.minimumNeediness; float maxBound = branch.maximumNeediness; if ((minBound < 0 || current_neediness >= minBound) && (maxBound < 0 || current_neediness < maxBound)) { currentPetFormIndex = branch.nextFormTreeId; currentPetFormNode = petFormDataTree[currentPetFormIndex]; break; } } if (musicHandler != null) { musicHandler.updateFormMusicData(currentPetFormIndex); } loadPetFormDataFile(currentPetFormNode.petFormDataFile); }
/* Uncomment this for testing * [ContextMenuItem("Advance form", "testAdvance")] * public float testAdvanceAtNeediness; * public void testAdvance() * { * petStatus.increaseNeediness(testAdvanceAtNeediness - petStatus.getNeediness()); * advancePetForm(); * } */ // Start is called before the first frame update void Start() { petStatus = GetComponent <PetStatus>(); currentPetFormNode = petFormDataTree[0]; currentPetFormIndex = 0; loadPetFormDataFile(currentPetFormNode.petFormDataFile); }