示例#1
0
        public static AnimatorController CreateAnimatorControllerAtPathWithClip(string path, AnimationClip clip)
        {
            AnimatorController animatorController = AnimatorController.CreateAnimatorControllerAtPath(path);

            animatorController.AddMotion(clip);
            return(animatorController);
        }
示例#2
0
        /// <summary>
        ///   <para>Creates an AnimatorController at the given path, and automatically create an AnimatorLayer  with an AnimatorStateMachine that will add a State with the AnimationClip in it.</para>
        /// </summary>
        /// <param name="path">The path where the AnimatorController will be created.</param>
        /// <param name="clip">The default clip that will be played by the AnimatorController.</param>
        public static AnimatorController CreateAnimatorControllerAtPathWithClip(string path, AnimationClip clip)
        {
            AnimatorController controllerAtPath = AnimatorController.CreateAnimatorControllerAtPath(path);

            controllerAtPath.AddMotion((Motion)clip);
            return(controllerAtPath);
        }
示例#3
0
    // Use this for initialization
    void Start()
    {
        AnimatorController controller =
            AnimatorController.CreateAnimatorControllerAtPath("Assets/resources/animation/controller/Enemy01.controller");
        Animator ownAnimator = gameObject.AddComponent <Animator>();

        ownAnimator.runtimeAnimatorController = controller;
    }
示例#4
0
    void test02()
    {
        AnimatorController controller =
            AnimatorController.CreateAnimatorControllerAtPath("Assets/animation.controller");
        // Add parameters
        //controller.AddLayer("hahaha");
        AnimatorState mstate = new AnimatorState();

        mstate.name = "myState";
        Motion mmotion = Resources.Load <AnimationClip>("animation/playerClip") as Motion;

        mmotion.name = "myMotion";
        AnimatorControllerLayer myLayer = new AnimatorControllerLayer();

        myLayer.name = "hahaha";
        //myLayer.SetOverrideBehaviours(mstate,;
        myLayer.SetOverrideMotion(mstate, mmotion);
        controller.AddLayer(myLayer);
    }