private void DrawSimpleControllerSection(PixelCrushers.DialogueSystem.SimpleController simpleController) { EditorWindowTools.StartIndentedSection(); if ((simpleController.idle == null) || (simpleController.runForward == null)) { EditorGUILayout.HelpBox("The player uses third-person shooter style controls. At a minimum, Idle and Run animations are required. Click Select Player to customize further.", MessageType.Info); } simpleController.idle = EditorGUILayout.ObjectField("Idle Animation", simpleController.idle, typeof(AnimationClip), false) as AnimationClip; simpleController.runForward = EditorGUILayout.ObjectField("Run Animation", simpleController.runForward, typeof(AnimationClip), false) as AnimationClip; EditorWindowTools.StartIndentedSection(); EditorGUILayout.LabelField("Optional", EditorStyles.boldLabel); simpleController.runSpeed = EditorGUILayout.FloatField("Run Speed", simpleController.runSpeed); simpleController.runBack = EditorGUILayout.ObjectField("Run Back", simpleController.runBack, typeof(AnimationClip), false) as AnimationClip; simpleController.aim = EditorGUILayout.ObjectField("Aim", simpleController.aim, typeof(AnimationClip), false) as AnimationClip; simpleController.fire = EditorGUILayout.ObjectField("Fire", simpleController.fire, typeof(AnimationClip), false) as AnimationClip; if (simpleController.fire != null) { if (simpleController.upperBodyMixingTransform == null) { EditorGUILayout.HelpBox("Specify the upper body mixing transform for the fire animation.", MessageType.Info); } simpleController.upperBodyMixingTransform = EditorGUILayout.ObjectField("Upper Body Transform", simpleController.upperBodyMixingTransform, typeof(Transform), true) as Transform; simpleController.fireLayerMask = EditorGUILayout.LayerField("Fire Layer", simpleController.fireLayerMask); simpleController.fireSound = EditorGUILayout.ObjectField("Fire Sound", simpleController.fireSound, typeof(AudioClip), false) as AudioClip; AudioSource audioSource = pcObject.GetComponent <AudioSource>(); if (audioSource == null) { audioSource = pcObject.AddComponent <AudioSource>(); audioSource.playOnAwake = false; audioSource.loop = false; } } EditorWindowTools.EndIndentedSection(); EditorWindowTools.EndIndentedSection(); }
private void DrawControlStage() { EditorGUILayout.LabelField("Control", EditorStyles.boldLabel); EditorWindowTools.StartIndentedSection(); PixelCrushers.DialogueSystem.SimpleController simpleController = pcObject.GetComponent <PixelCrushers.DialogueSystem.SimpleController>(); NavigateOnMouseClick navigateOnMouseClick = pcObject.GetComponent <NavigateOnMouseClick>(); ControlStyle controlStyle = (simpleController != null) ? ControlStyle.ThirdPersonShooter : (navigateOnMouseClick != null) ? ControlStyle.FollowMouseClicks : ControlStyle.Custom; EditorGUILayout.HelpBox("How will the player control movement? (Select Custom to provide your own control components instead of using the Dialogue System's.)", MessageType.Info); controlStyle = (ControlStyle)EditorGUILayout.EnumPopup("Control", controlStyle); switch (controlStyle) { case ControlStyle.ThirdPersonShooter: DestroyImmediate(navigateOnMouseClick); DrawSimpleControllerSection(simpleController ?? pcObject.AddComponent <PixelCrushers.DialogueSystem.SimpleController>()); break; case ControlStyle.FollowMouseClicks: DestroyImmediate(simpleController); DrawNavigateOnMouseClickSection(navigateOnMouseClick ?? pcObject.AddComponent <NavigateOnMouseClick>()); break; default: DestroyImmediate(simpleController); DestroyImmediate(navigateOnMouseClick); break; } if (GUILayout.Button("Select Player", GUILayout.Width(100))) { Selection.activeGameObject = pcObject; } EditorWindowTools.EndIndentedSection(); DrawNavigationButtons(true, true, false); }