コード例 #1
0
        private static AnimatorController GenerateSelectableAnimatorContoller(AnimationTriggers animationTriggers, Selectable target)
        {
            AnimatorController result;

            if (target == null)
            {
                result = null;
            }
            else
            {
                string saveControllerPath = SelectableEditor.GetSaveControllerPath(target);
                if (string.IsNullOrEmpty(saveControllerPath))
                {
                    result = null;
                }
                else
                {
                    string             name  = (!string.IsNullOrEmpty(animationTriggers.normalTrigger)) ? animationTriggers.normalTrigger : "Normal";
                    string             name2 = (!string.IsNullOrEmpty(animationTriggers.highlightedTrigger)) ? animationTriggers.highlightedTrigger : "Highlighted";
                    string             name3 = (!string.IsNullOrEmpty(animationTriggers.pressedTrigger)) ? animationTriggers.pressedTrigger : "Pressed";
                    string             name4 = (!string.IsNullOrEmpty(animationTriggers.disabledTrigger)) ? animationTriggers.disabledTrigger : "Disabled";
                    AnimatorController animatorController = AnimatorController.CreateAnimatorControllerAtPath(saveControllerPath);
                    SelectableEditor.GenerateTriggerableTransition(name, animatorController);
                    SelectableEditor.GenerateTriggerableTransition(name2, animatorController);
                    SelectableEditor.GenerateTriggerableTransition(name3, animatorController);
                    SelectableEditor.GenerateTriggerableTransition(name4, animatorController);
                    AssetDatabase.ImportAsset(saveControllerPath);
                    result = animatorController;
                }
            }
            return(result);
        }
コード例 #2
0
        private static AnimatorController GenerateSelectableAnimatorContoller(AnimationTriggers animationTriggers, Selectable target)
        {
            if ((UnityEngine.Object)target == (UnityEngine.Object)null)
            {
                return((AnimatorController)null);
            }
            string saveControllerPath = SelectableEditor.GetSaveControllerPath(target);

            if (string.IsNullOrEmpty(saveControllerPath))
            {
                return((AnimatorController)null);
            }
            string             name1            = !string.IsNullOrEmpty(animationTriggers.normalTrigger) ? animationTriggers.normalTrigger : "Normal";
            string             name2            = !string.IsNullOrEmpty(animationTriggers.highlightedTrigger) ? animationTriggers.highlightedTrigger : "Highlighted";
            string             name3            = !string.IsNullOrEmpty(animationTriggers.pressedTrigger) ? animationTriggers.pressedTrigger : "Pressed";
            string             name4            = !string.IsNullOrEmpty(animationTriggers.disabledTrigger) ? animationTriggers.disabledTrigger : "Disabled";
            AnimatorController controllerAtPath = AnimatorController.CreateAnimatorControllerAtPath(saveControllerPath);

            SelectableEditor.GenerateTriggerableTransition(name1, controllerAtPath);
            SelectableEditor.GenerateTriggerableTransition(name2, controllerAtPath);
            SelectableEditor.GenerateTriggerableTransition(name3, controllerAtPath);
            SelectableEditor.GenerateTriggerableTransition(name4, controllerAtPath);
            AssetDatabase.ImportAsset(saveControllerPath);
            return(controllerAtPath);
        }