void fineTuneWindow(int windowID) { //Display movements to choose movementSelectionInt = GUI.SelectionGrid(new Rect(0, 20, fineTuneWindowRect.width, 150), movementSelectionInt, movementNames, 3); scrollPosition = GUI.BeginScrollView(new Rect(0, 180, fineTuneWindowRect.width, 150), scrollPosition, new Rect(0, 0, fineTuneWindowRect.width, movementNames.Length * 30)); //Show chosen movements settings for (int f = 0; f < modelAnimator.animations[movementSelectionInt].frames.Length; ++f) { //frame label GUI.Label(new Rect(10, 21 * f, fineTuneWindowRect.width * 0.3F, 20), "Frame " + f); sliderValue = modelAnimator.animations[movementSelectionInt].frames[f].playbackSpeed; //frame speed slider modelAnimator.animations[movementSelectionInt].frames[f].playbackSpeed = GUI.HorizontalSlider(new Rect(20 + fineTuneWindowRect.width * 0.3F, 21 * f, fineTuneWindowRect.width * 0.5F, 20), sliderValue, 0, 100); } GUI.EndScrollView(); //Test button tests the current movement if (GUI.Button(new Rect(0, 335, 120, 30), "Test Movement")) { modelAnimator.animateModel(movementSelectionInt); } //Save button saves all if (GUI.Button(new Rect(0, 370, 120, 30), "Save")) { string serializedAnimations = modelAnimator.serializeAnimations(); modelAnimator.saveAnimations(serializedAnimations); } }
// Use this for initialization void Start() { modelAnimator = GetComponent <ModelAnimator>(); //Load starting positions startingPositions = modelAnimator.readAnimationsFromFile(Application.dataPath + "/Resources/NAOStartingPositions.txt"); //Set returnToStartingPosition to false for each one foreach (ModelAnimation anim in startingPositions) { anim.returnToStartingPosition = false; } //Load locally created moves modelAnimator.animations = modelAnimator.readAnimationsFromFile(); //Move to fighting stance StartCoroutine(modelAnimator.animateModel(startingPositions[1], val => isMoving = val)); }