/*---------------------------------------------------------------*/ public void ChangePose(int poseIndex, float speed = 1.0f, float blend = 0.15f) { if (!emitorFlag) { mecanimControl.Play(mecanimControl.animations[poseIndex], blend); mecanimControl.SetSpeed(speed); StartCoroutine(Emitor()); // avoid frequent transition } }
void OnGUI() { GUILayout.Label("Speed (" + animSpeed + ")"); animSpeed = GUILayout.HorizontalSlider(animSpeed, 0, 10f); mecanimControl.SetSpeed(animSpeed); GUILayout.Label("Rotation (" + currentRotation + ")"); currentRotation = GUILayout.HorizontalSlider(currentRotation, 0.0f, 360.0f); transform.localEulerAngles = new Vector3(0.0f, currentRotation, 0.0f); GUILayout.Label("Blending (" + blendDuration + ")"); blendDuration = GUILayout.HorizontalSlider(blendDuration, 0, 1f); mecanimControl.defaultTransitionDuration = blendDuration; GUILayout.Space(10); if (GUILayout.Button("Mirror " + mirror)) { mirror = !mirror; mecanimControl.SetMirror(mirror); } if (GUILayout.Button("Debug " + mecanimControl.debugMode)) { mecanimControl.debugMode = !mecanimControl.debugMode; } GUILayout.Space(10); foreach (AnimationData animationData in mecanimControl.animations) { if (GUILayout.Button(animationData.clipName)) { mecanimControl.Play(animationData, mirror); } } }