예제 #1
0
    public override void ActionAnimGUI(ActionAnim action, List <ActionParameter> parameters)
    {
                #if UNITY_EDITOR
        action.methodMecanim = (AnimMethodMecanim)EditorGUILayout.EnumPopup("Method:", action.methodMecanim);

        if (action.methodMecanim == AnimMethodMecanim.ChangeParameterValue || action.methodMecanim == AnimMethodMecanim.PlayCustom)
        {
            action.parameterID = AC.Action.ChooseParameterGUI("Animator:", parameters, action.parameterID, ParameterType.GameObject);
            if (action.parameterID >= 0)
            {
                action.constantID = 0;
                action.animator   = null;
            }
            else
            {
                action.animator = (Animator)EditorGUILayout.ObjectField("Animator:", action.animator, typeof(Animator), true);

                action.constantID = action.FieldToID <Animator> (action.animator, action.constantID);
                action.animator   = action.IDToField <Animator> (action.animator, action.constantID, false);
            }
        }

        if (action.methodMecanim == AnimMethodMecanim.ChangeParameterValue)
        {
            action.parameterName        = EditorGUILayout.TextField("Parameter to affect:", action.parameterName);
            action.mecanimParameterType = (MecanimParameterType)EditorGUILayout.EnumPopup("Parameter type:", action.mecanimParameterType);
            if (action.mecanimParameterType != MecanimParameterType.Trigger)
            {
                action.parameterValue = EditorGUILayout.FloatField("Set as value:", action.parameterValue);
            }
        }
        else if (action.methodMecanim == AnimMethodMecanim.PlayCustom)
        {
            action.clip2D   = EditorGUILayout.TextField("Clip:", action.clip2D);
            action.layerInt = EditorGUILayout.IntField("Mecanim layer:", action.layerInt);
            action.fadeTime = EditorGUILayout.Slider("Transition time:", action.fadeTime, 0f, 2f);
            action.willWait = EditorGUILayout.Toggle("Wait until finish?", action.willWait);
        }
        else if (action.methodMecanim == AnimMethodMecanim.BlendShape)
        {
            EditorGUILayout.HelpBox("This method is not compatible with Sprites Unity Complex.", MessageType.Info);
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(action);
        }
                #endif
    }
예제 #2
0
    public override void ActionAnimGUI(ActionAnim action, List <ActionParameter> parameters)
    {
                #if UNITY_EDITOR
        action.method = (AnimMethod)EditorGUILayout.EnumPopup("Method:", action.method);

        action.parameterID = AC.Action.ChooseParameterGUI("Object:", parameters, action.parameterID, ParameterType.GameObject);
        if (action.parameterID >= 0)
        {
            action.constantID = 0;
            action._anim2D    = null;
        }
        else
        {
            action._anim2D = (Transform)EditorGUILayout.ObjectField("Object:", action._anim2D, typeof(Transform), true);

            action.constantID = action.FieldToID(action._anim2D, action.constantID);
            action._anim2D    = action.IDToField(action._anim2D, action.constantID, false);
        }

        if (action.method == AnimMethod.PlayCustom)
        {
            action.clip2D     = EditorGUILayout.TextField("Clip:", action.clip2D);
            action.wrapMode2D = (ActionAnim.WrapMode2D)EditorGUILayout.EnumPopup("Play mode:", action.wrapMode2D);

            if (action.wrapMode2D == ActionAnim.WrapMode2D.Once)
            {
                action.willWait = EditorGUILayout.Toggle("Wait until finish?", action.willWait);
            }
            else
            {
                action.willWait = false;
            }
        }
        else if (action.method == AnimMethod.BlendShape)
        {
            EditorGUILayout.HelpBox("BlendShapes are not available in 2D animation.", MessageType.Info);
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(action);
        }
                #endif
    }
예제 #3
0
    public override void ActionAnimGUI(ActionAnim action, List <ActionParameter> parameters)
    {
                #if UNITY_EDITOR
        action.method = (AnimMethod)EditorGUILayout.EnumPopup("Method:", action.method);

        if (action.method == AnimMethod.PlayCustom)
        {
            action.parameterID = AC.Action.ChooseParameterGUI("Animator:", parameters, action.parameterID, ParameterType.GameObject);
            if (action.parameterID >= 0)
            {
                action.constantID = 0;
                action.animator   = null;
            }
            else
            {
                action.animator = (Animator)EditorGUILayout.ObjectField("Animator:", action.animator, typeof(Animator), true);

                action.constantID = action.FieldToID <Animator> (action.animator, action.constantID);
                action.animator   = action.IDToField <Animator> (action.animator, action.constantID, false);
            }

            action.clip2D   = EditorGUILayout.TextField("Clip:", action.clip2D);
            action.layerInt = EditorGUILayout.IntField("Mecanim layer:", action.layerInt);
            action.fadeTime = EditorGUILayout.Slider("Transition time:", action.fadeTime, 0f, 2f);
            action.willWait = EditorGUILayout.Toggle("Wait until finish?", action.willWait);
        }
        else if (action.method == AnimMethod.StopCustom)
        {
            EditorGUILayout.HelpBox("'Stop Custom' is not available for Unity-based 2D animation.", MessageType.Info);
        }
        else if (action.method == AnimMethod.BlendShape)
        {
            EditorGUILayout.HelpBox("BlendShapes are not available in 2D animation.", MessageType.Info);
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(action);
        }
                #endif
    }
예제 #4
0
    public override void ActionAnimGUI(ActionAnim action, List <ActionParameter> parameters)
    {
                #if UNITY_EDITOR
        action.methodMecanim = (AnimMethodMecanim)EditorGUILayout.EnumPopup("Method:", action.methodMecanim);

        if (action.methodMecanim == AnimMethodMecanim.ChangeParameterValue || action.methodMecanim == AnimMethodMecanim.PlayCustom)
        {
            action.parameterID = AC.Action.ChooseParameterGUI("Animator:", parameters, action.parameterID, ParameterType.GameObject);
            if (action.parameterID >= 0)
            {
                action.constantID = 0;
                action.animator   = null;
            }
            else
            {
                action.animator = (Animator)EditorGUILayout.ObjectField("Animator:", action.animator, typeof(Animator), true);

                action.constantID = action.FieldToID <Animator> (action.animator, action.constantID);
                action.animator   = action.IDToField <Animator> (action.animator, action.constantID, false);
            }
        }

        if (action.methodMecanim == AnimMethodMecanim.ChangeParameterValue)
        {
            action.parameterName        = EditorGUILayout.TextField("Parameter to affect:", action.parameterName);
            action.mecanimParameterType = (MecanimParameterType)EditorGUILayout.EnumPopup("Parameter type:", action.mecanimParameterType);
            if (action.mecanimParameterType != MecanimParameterType.Trigger)
            {
                action.parameterValue = EditorGUILayout.FloatField("Set as value:", action.parameterValue);
            }
        }
        else if (action.methodMecanim == AnimMethodMecanim.PlayCustom)
        {
            action.clip2D   = EditorGUILayout.TextField("Clip:", action.clip2D);
            action.layerInt = EditorGUILayout.IntField("Mecanim layer:", action.layerInt);
            action.fadeTime = EditorGUILayout.Slider("Transition time:", action.fadeTime, 0f, 2f);
            action.willWait = EditorGUILayout.Toggle("Wait until finish?", action.willWait);
        }
        else if (action.methodMecanim == AnimMethodMecanim.BlendShape)
        {
            action.isPlayer = EditorGUILayout.Toggle("Is player?", action.isPlayer);
            if (!action.isPlayer)
            {
                action.parameterID = AC.Action.ChooseParameterGUI("Object:", parameters, action.parameterID, ParameterType.GameObject);
                if (action.parameterID >= 0)
                {
                    action.constantID  = 0;
                    action.shapeObject = null;
                }
                else
                {
                    action.shapeObject = (Shapeable)EditorGUILayout.ObjectField("Object:", action.shapeObject, typeof(Shapeable), true);

                    action.constantID  = action.FieldToID <Shapeable> (action.shapeObject, action.constantID);
                    action.shapeObject = action.IDToField <Shapeable> (action.shapeObject, action.constantID, false);
                }
            }

            action.shapeKey   = EditorGUILayout.IntField("Shape key:", action.shapeKey);
            action.shapeValue = EditorGUILayout.Slider("Shape value:", action.shapeValue, 0f, 100f);
            action.fadeTime   = EditorGUILayout.Slider("Transition time:", action.fadeTime, 0f, 2f);
            action.willWait   = EditorGUILayout.Toggle("Wait until finish?", action.willWait);
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(action);
        }
                #endif
    }
예제 #5
0
    public override void ActionAnimGUI(ActionAnim action, List <ActionParameter> parameters)
    {
                #if UNITY_EDITOR
        action.method = (AnimMethod)EditorGUILayout.EnumPopup("Method:", action.method);

        if (action.method == AnimMethod.PlayCustom || action.method == AnimMethod.StopCustom)
        {
            action.parameterID = Action.ChooseParameterGUI("Object:", parameters, action.parameterID, ParameterType.GameObject);
            if (action.parameterID >= 0)
            {
                action.constantID = 0;
                action._anim      = null;
            }
            else
            {
                action._anim = (Animation)EditorGUILayout.ObjectField("Object:", action._anim, typeof(Animation), true);

                action.constantID = action.FieldToID <Animation> (action._anim, action.constantID);
                action._anim      = action.IDToField <Animation> (action._anim, action.constantID, false);
            }

            action.clip = (AnimationClip)EditorGUILayout.ObjectField("Clip:", action.clip, typeof(AnimationClip), true);

            if (action.method == AnimMethod.PlayCustom)
            {
                action.playMode  = (AnimPlayMode)EditorGUILayout.EnumPopup("Play mode:", action.playMode);
                action.blendMode = (AnimationBlendMode)EditorGUILayout.EnumPopup("Blend mode:", action.blendMode);
            }

            action.fadeTime = EditorGUILayout.Slider("Transition time:", action.fadeTime, 0f, 1f);
        }
        else if (action.method == AnimMethod.BlendShape)
        {
            action.isPlayer = EditorGUILayout.Toggle("Is player?", action.isPlayer);
            if (!action.isPlayer)
            {
                action.parameterID = Action.ChooseParameterGUI("Object:", parameters, action.parameterID, ParameterType.GameObject);
                if (action.parameterID >= 0)
                {
                    action.constantID  = 0;
                    action.shapeObject = null;
                }
                else
                {
                    action.shapeObject = (Shapeable)EditorGUILayout.ObjectField("Object:", action.shapeObject, typeof(Shapeable), true);

                    action.constantID  = action.FieldToID <Shapeable> (action.shapeObject, action.constantID);
                    action.shapeObject = action.IDToField <Shapeable> (action.shapeObject, action.constantID, false);
                }
            }

            action.shapeKey   = EditorGUILayout.IntField("Shape key:", action.shapeKey);
            action.shapeValue = EditorGUILayout.Slider("Shape value:", action.shapeValue, 0f, 100f);
            action.fadeTime   = EditorGUILayout.Slider("Transition time:", action.fadeTime, 0f, 2f);
        }

        action.willWait = EditorGUILayout.Toggle("Wait until finish?", action.willWait);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(action);
        }
                #endif
    }