Exemplo n.º 1
0
    override public void ShowGUI()
    {
        method = (AnimMethodChar)EditorGUILayout.EnumPopup("Method:", method);

        isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer);
        if (!isPlayer)
        {
            animChar = (Char)EditorGUILayout.ObjectField("Character:", animChar, typeof(Char), true);
        }

        if (method == AnimMethodChar.PlayCustom || method == AnimMethodChar.StopCustom)
        {
            clip = (AnimationClip)EditorGUILayout.ObjectField("Clip:", clip, typeof(AnimationClip), true);

            if (method == AnimMethodChar.PlayCustom)
            {
                layer = (AnimLayer)EditorGUILayout.EnumPopup("Layer:", layer);

                if (layer == AnimLayer.Base)
                {
                    EditorGUILayout.LabelField("Blend mode:", "Blend");
                    playModeBase = (AnimPlayModeBase)EditorGUILayout.EnumPopup("Play mode:", playModeBase);
                }
                else
                {
                    blendMode = (AnimationBlendMode)EditorGUILayout.EnumPopup("Blend mode:", blendMode);
                    playMode  = (AnimPlayMode)EditorGUILayout.EnumPopup("Play mode:", playMode);
                }
            }

            fadeTime = EditorGUILayout.Slider("Transition time:", fadeTime, 0f, 1f);
            willWait = EditorGUILayout.Toggle("Pause until finish?", willWait);
        }

        else if (method == AnimMethodChar.SetStandard)
        {
            clip     = (AnimationClip)EditorGUILayout.ObjectField("Clip:", clip, typeof(AnimationClip), true);
            standard = (AnimStandard)EditorGUILayout.EnumPopup("Change:", standard);
        }

        AfterRunningOption();
    }
Exemplo n.º 2
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer);
            if (isPlayer)
            {
                if (Application.isPlaying)
                {
                    animChar = KickStarter.player;
                }
                else
                {
                    animChar = AdvGame.GetReferences().settingsManager.GetDefaultPlayer();
                }
            }
            else
            {
                parameterID = Action.ChooseParameterGUI("Character:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    animChar   = null;
                }
                else
                {
                    animChar = (Char)EditorGUILayout.ObjectField("Character:", animChar, typeof(Char), true);

                    constantID = FieldToID <Char> (animChar, constantID);
                    animChar   = IDToField <Char> (animChar, constantID, true);
                }
            }

            if (animChar)
            {
                ResetAnimationEngine(animChar.animationEngine);
            }

            if (editingAnimEngine != null)
            {
                method = (ActionCharAnimSpine.AnimMethodChar)EditorGUILayout.EnumPopup("Method:", method);

                if (method == ActionCharAnimSpine.AnimMethodChar.PlayCustom)
                {
                    clip2D = EditorGUILayout.TextField("Clip:", clip2D);

                    layerInt = EditorGUILayout.IntField("Layer:", layerInt);

                    timeScale = EditorGUILayout.FloatField("Timescale:", timeScale);

                    atTime = EditorGUILayout.FloatField("At time:", atTime);

                    forceDirection = EditorGUILayout.Toggle("Force direction?", forceDirection);
                    if (forceDirection)
                    {
                        newDirection = (CharDirection)EditorGUILayout.EnumPopup("Direction:", newDirection);
                    }

                    loop = EditorGUILayout.Toggle("Loop?", loop);
                    if (loop)
                    {
                        loopTimes = EditorGUILayout.IntField("Looping times:", loopTimes);
                    }

                    willWait = EditorGUILayout.Toggle("Wait until finish?", willWait);
                    if (willWait)
                    {
                        idleAfter = EditorGUILayout.Toggle("Return to idle after?", idleAfter);
                        if (idleAfter)
                        {
                            willTransform = EditorGUILayout.Toggle("Reposition before idle?", willTransform);
                            if (willTransform)
                            {
                                transformOffset = EditorGUILayout.Vector3Field("Point:", transformOffset);
                            }
                        }
                    }
                }
                else if (method == ActionCharAnimSpine.AnimMethodChar.SetStandard)
                {
                    clip2D   = EditorGUILayout.TextField("Clip:", clip2D);
                    standard = (AnimStandard)EditorGUILayout.EnumPopup("Change:", standard);

                    if (standard == AnimStandard.Walk || standard == AnimStandard.Run)
                    {
                        changeSound = EditorGUILayout.Toggle("Change sound?", changeSound);
                        if (changeSound)
                        {
                            newSoundParameterID = Action.ChooseParameterGUI("New sound:", parameters, newSoundParameterID, ParameterType.UnityObject);
                            if (newSoundParameterID < 0)
                            {
                                newSound = (AudioClip)EditorGUILayout.ObjectField("New sound:", newSound, typeof(AudioClip), false);
                            }
                        }
                        changeSpeed = EditorGUILayout.Toggle("Change speed?", changeSpeed);
                        if (changeSpeed)
                        {
                            newSpeed = EditorGUILayout.FloatField("New speed:", newSpeed);
                        }
                    }
                }
                else if (method == ActionCharAnimSpine.AnimMethodChar.ResetToIdle)
                {
                    idleAfterCustom = EditorGUILayout.Toggle("Wait for animation to finish?", idleAfterCustom);
                }

                if (GUI.changed)
                {
                    EditorUtility.SetDirty(this);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("This Action requires a Character before more options will show.", MessageType.Info);
            }

            AfterRunningOption();
        }