예제 #1
0
    public override void CharSettingsGUI()
    {
                #if UNITY_EDITOR
        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Mecanim parameters:", EditorStyles.boldLabel);

        if (AdvGame.GetReferences() && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.IsTopDown())
        {
            character.spriteChild = (Transform)EditorGUILayout.ObjectField("Animator child:", character.spriteChild, typeof(Transform), true);
        }
        else
        {
            character.spriteChild = null;
        }

        character.moveSpeedParameter = EditorGUILayout.TextField("Move speed float:", character.moveSpeedParameter);
        character.turnParameter      = EditorGUILayout.TextField("Turn float:", character.turnParameter);
        character.talkParameter      = EditorGUILayout.TextField("Talk bool:", character.talkParameter);

        if (AdvGame.GetReferences() && AdvGame.GetReferences().speechManager&&
            AdvGame.GetReferences().speechManager.lipSyncMode != LipSyncMode.Off && AdvGame.GetReferences().speechManager.lipSyncMode != LipSyncMode.FaceFX)
        {
            if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.PortraitAndGameObject)
            {
                if (character.GetShapeable())
                {
                    character.lipSyncGroupID = ActionBlendShape.ShapeableGroupGUI("Phoneme shape group:", character.GetShapeable().shapeGroups, character.lipSyncGroupID);
                }
                else
                {
                    EditorGUILayout.HelpBox("Attach a Shapeable script to show phoneme options", MessageType.Info);
                }
            }
            else if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.GameObjectTexture)
            {
                if (character.GetComponent <LipSyncTexture>() == null)
                {
                    EditorGUILayout.HelpBox("Attach a LipSyncTexture script to allow texture lip-syncing.", MessageType.Info);
                }
            }
        }

        if (!character.ikHeadTurning)
        {
            character.headYawParameter   = EditorGUILayout.TextField("Head yaw float:", character.headYawParameter);
            character.headPitchParameter = EditorGUILayout.TextField("Head pitch float:", character.headPitchParameter);
        }

        character.verticalMovementParameter = EditorGUILayout.TextField("Vertical movement float:", character.verticalMovementParameter);
        if (character is Player)
        {
            Player player = (Player)character;
            player.jumpParameter = EditorGUILayout.TextField("Jump bool:", player.jumpParameter);
        }
        character.talkingAnimation = TalkingAnimation.Standard;

        EditorGUILayout.EndVertical();
        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Mecanim settings:", EditorStyles.boldLabel);

        character.headLayer  = EditorGUILayout.IntField("Head layer #:", character.headLayer);
        character.mouthLayer = EditorGUILayout.IntField("Mouth layer #:", character.mouthLayer);

        character.ikHeadTurning = EditorGUILayout.Toggle("IK head-turning?", character.ikHeadTurning);
        if (character.ikHeadTurning)
        {
                        #if UNITY_5 || UNITY_PRO
            EditorGUILayout.HelpBox("'IK Pass' must be enabled for this character's Base layer.", MessageType.Info);
                        #else
            EditorGUILayout.HelpBox("This features is only available with Unity 5 or Unity Pro.", MessageType.Info);
                        #endif
        }

        character.relyOnRootMotion  = EditorGUILayout.BeginToggleGroup("Rely on Root Motion?", character.relyOnRootMotion);
        character.rootTurningFactor = EditorGUILayout.Slider("Root Motion turning:", character.rootTurningFactor, 0f, 1f);
        EditorGUILayout.EndToggleGroup();
        character.doWallReduction = EditorGUILayout.BeginToggleGroup("Slow movement near wall colliders?", character.doWallReduction);
        character.wallLayer       = EditorGUILayout.TextField("Wall collider layer:", character.wallLayer);
        character.wallDistance    = EditorGUILayout.Slider("Collider distance:", character.wallDistance, 0f, 2f);
        EditorGUILayout.EndToggleGroup();

        EditorGUILayout.EndVertical();
        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Bone transforms:", EditorStyles.boldLabel);

        character.neckBone      = (Transform)EditorGUILayout.ObjectField("Neck bone:", character.neckBone, typeof(Transform), true);
        character.leftHandBone  = (Transform)EditorGUILayout.ObjectField("Left hand:", character.leftHandBone, typeof(Transform), true);
        character.rightHandBone = (Transform)EditorGUILayout.ObjectField("Right hand:", character.rightHandBone, typeof(Transform), true);
        EditorGUILayout.EndVertical();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(character);
        }
                #endif
    }
예제 #2
0
    public override void CharSettingsGUI()
    {
                #if UNITY_EDITOR
        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Standard 3D animations:", EditorStyles.boldLabel);

        if (AdvGame.GetReferences() && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.IsTopDown())
        {
            character.spriteChild = (Transform)EditorGUILayout.ObjectField("Animation child:", character.spriteChild, typeof(Transform), true);
        }
        else
        {
            character.spriteChild = null;
        }

        character.talkingAnimation = (TalkingAnimation)EditorGUILayout.EnumPopup("Talk animation style:", character.talkingAnimation);
        character.idleAnim         = (AnimationClip)EditorGUILayout.ObjectField("Idle:", character.idleAnim, typeof(AnimationClip), false);
        character.walkAnim         = (AnimationClip)EditorGUILayout.ObjectField("Walk:", character.walkAnim, typeof(AnimationClip), false);
        character.runAnim          = (AnimationClip)EditorGUILayout.ObjectField("Run:", character.runAnim, typeof(AnimationClip), false);
        if (character.talkingAnimation == TalkingAnimation.Standard)
        {
            character.talkAnim = (AnimationClip)EditorGUILayout.ObjectField("Talk:", character.talkAnim, typeof(AnimationClip), false);
        }

        if (AdvGame.GetReferences() && AdvGame.GetReferences().speechManager)
        {
            if (AdvGame.GetReferences() && AdvGame.GetReferences().speechManager&&
                AdvGame.GetReferences().speechManager.lipSyncMode != LipSyncMode.Off && AdvGame.GetReferences().speechManager.lipSyncMode != LipSyncMode.FaceFX)
            {
                if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.PortraitAndGameObject)
                {
                    if (character.GetShapeable())
                    {
                        character.lipSyncGroupID = ActionBlendShape.ShapeableGroupGUI("Phoneme shape group:", character.GetShapeable().shapeGroups, character.lipSyncGroupID);
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("Attach a Shapeable script to show phoneme options", MessageType.Info);
                    }
                }
                else if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.GameObjectTexture)
                {
                    if (character.GetComponent <LipSyncTexture>() == null)
                    {
                        EditorGUILayout.HelpBox("Attach a LipSyncTexture script to allow texture lip-syncing.", MessageType.Info);
                    }
                }
            }
        }

        character.turnLeftAnim      = (AnimationClip)EditorGUILayout.ObjectField("Turn left:", character.turnLeftAnim, typeof(AnimationClip), false);
        character.turnRightAnim     = (AnimationClip)EditorGUILayout.ObjectField("Turn right:", character.turnRightAnim, typeof(AnimationClip), false);
        character.headLookLeftAnim  = (AnimationClip)EditorGUILayout.ObjectField("Head look left:", character.headLookLeftAnim, typeof(AnimationClip), false);
        character.headLookRightAnim = (AnimationClip)EditorGUILayout.ObjectField("Head look right:", character.headLookRightAnim, typeof(AnimationClip), false);
        character.headLookUpAnim    = (AnimationClip)EditorGUILayout.ObjectField("Head look up:", character.headLookUpAnim, typeof(AnimationClip), false);
        character.headLookDownAnim  = (AnimationClip)EditorGUILayout.ObjectField("Head look down:", character.headLookDownAnim, typeof(AnimationClip), false);
        if (character is Player)
        {
            Player player = (Player)character;
            player.jumpAnim = (AnimationClip)EditorGUILayout.ObjectField("Jump:", player.jumpAnim, typeof(AnimationClip), false);
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Bone transforms:", EditorStyles.boldLabel);

        character.upperBodyBone = (Transform)EditorGUILayout.ObjectField("Upper body:", character.upperBodyBone, typeof(Transform), true);
        character.neckBone      = (Transform)EditorGUILayout.ObjectField("Neck bone:", character.neckBone, typeof(Transform), true);
        character.leftArmBone   = (Transform)EditorGUILayout.ObjectField("Left arm:", character.leftArmBone, typeof(Transform), true);
        character.rightArmBone  = (Transform)EditorGUILayout.ObjectField("Right arm:", character.rightArmBone, typeof(Transform), true);
        character.leftHandBone  = (Transform)EditorGUILayout.ObjectField("Left hand:", character.leftHandBone, typeof(Transform), true);
        character.rightHandBone = (Transform)EditorGUILayout.ObjectField("Right hand:", character.rightHandBone, typeof(Transform), true);
        EditorGUILayout.EndVertical();

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