Exemple #1
0
    private void DrawFrames(AAnimationClip currentClip, AKeyframe currentKeyframe)
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("Sprite", GUILayout.Width(70));
        currentKeyframe.Sprite = EditorGUILayout.ObjectField(currentKeyframe.Sprite, typeof(Sprite), true) as Sprite;
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Frame " + (keyframesIndex + 1) + "/" +
                                   currentClip.keyframes.Length);

        if (GUILayout.Button("<", GUILayout.Width(30)))
        {
            keyframesIndex--;
            if (keyframesIndex < 0)
            {
                keyframesIndex = currentClip.keyframes.Length - 1;
            }
        }
        if (GUILayout.Button(">", GUILayout.Width(30)))
        {
            keyframesIndex++;
            if (keyframesIndex >= currentClip.keyframes.Length)
            {
                keyframesIndex = 0;
            }
        }
        GUILayout.EndHorizontal();
    }
Exemple #2
0
    public override void OnInspectorGUI()
    {
        GUILayout.BeginVertical();
        GUI.skin.label.wordWrap = true;

        AAnimationClip currentClip     = null;
        AKeyframe      currentKeyframe = null;

        if (targetComponents.ZeroHitbox.AnimationClipsStringList != null && targetComponents.ZeroHitbox.AnimationClips.Length > 0)
        {
            DrawAnimationClips();
        }
        else
        {
            GUILayout.Label("You don't have any animation clips in your Animator component. Add some so we can show them.");

            GUILayout.EndVertical();
            return;
        }

        if (targetComponents.ZeroHitbox.HasLists)
        {
            currentClip     = targetComponents.ZeroHitbox.AnimationClips[animationClipsIndex];
            currentKeyframe = currentClip.keyframes[keyframesIndex];

            DrawFrames(currentClip, currentKeyframe);
        }

        showHitboxesGUI = EditorGUILayout.Foldout(showHitboxesGUI, "Hitboxes");

        if (showHitboxesGUI)
        {
            DrawHitboxes(currentKeyframe);
        }

        GUILayout.EndVertical();
    }
    private void DrawFrames(AAnimationClip currentClip, AKeyframe currentKeyframe)
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("Sprite", GUILayout.Width(70));
        currentKeyframe.Sprite = EditorGUILayout.ObjectField(currentKeyframe.Sprite, typeof(Sprite), true) as Sprite;
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Frame " + (keyframesIndex + 1) + "/" +
                                         currentClip.keyframes.Length);

        if (GUILayout.Button("<", GUILayout.Width(30)))
        {
            keyframesIndex--;
            if (keyframesIndex < 0)
                keyframesIndex = currentClip.keyframes.Length - 1;
        }
        if (GUILayout.Button(">", GUILayout.Width(30)))
        {
            keyframesIndex++;
            if (keyframesIndex >= currentClip.keyframes.Length)
            {
                keyframesIndex = 0;
            }
        }
        GUILayout.EndHorizontal();
    }