private void ArrowGUI(Arrow arrow, string label)
        {
            if (arrow != null)
            {
                ArrowPrompt _target = (ArrowPrompt)target;

                arrow.isPresent = EditorGUILayout.Toggle("Provide?", arrow.isPresent);

                if (arrow.isPresent)
                {
                    arrow.texture = (Texture2D)EditorGUILayout.ObjectField("Icon texture:", arrow.texture, typeof(Texture2D), true);

                    EditorGUILayout.BeginHorizontal();
                    arrow.linkedCutscene = (Cutscene)EditorGUILayout.ObjectField("Linked Cutscene:", arrow.linkedCutscene, typeof(Cutscene), true);
                    if (arrow.linkedCutscene == null)
                    {
                        if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                        {
                            Undo.RecordObject(_target, "Auto-create Cutscene");
                            Cutscene newCutscene = SceneManager.AddPrefab("Logic", "Cutscene", true, false, true).GetComponent <Cutscene>();

                            newCutscene.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + ": " + label);
                            arrow.linkedCutscene        = newCutscene;
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
        }
Esempio n. 2
0
        private string GenerateInteractionName(string suffix, bool isAsset)
        {
            string hotspotName = _target.gameObject.name;

            if (_target != null && _target.hotspotName != null && _target.hotspotName.Length > 0)
            {
                hotspotName = _target.hotspotName;
            }
            return(AdvGame.UniqueName(hotspotName + ((isAsset) ? "_" : ": ") + suffix));
        }
		public override void OnInspectorGUI ()
		{
			GameCamera25D _target = (GameCamera25D) target;
			
			EditorGUILayout.BeginVertical ("Button");
			EditorGUILayout.LabelField ("Background image", EditorStyles.boldLabel);
		
			EditorGUILayout.BeginHorizontal ();
			_target.backgroundImage = (BackgroundImage) EditorGUILayout.ObjectField ("Prefab:", _target.backgroundImage, typeof (BackgroundImage), true);
			
			if (_target.backgroundImage)
			{
				if (GUILayout.Button ("Set as active", GUILayout.MaxWidth (90f)))
				{
					Undo.RecordObject (_target, "Set active background");
					
					_target.SetActiveBackground ();
					SnapCameraInEditor (_target);
				}
			}
			else
			{
				if (GUILayout.Button ("Create", GUILayout.MaxWidth (90f)))
				{
					Undo.RecordObject (_target, "Create Background Image");
					BackgroundImage newBackgroundImage = SceneManager.AddPrefab ("SetGeometry", "BackgroundImage", true, false, true).GetComponent <BackgroundImage>();
					
					string cameraName = _target.gameObject.name;

					newBackgroundImage.gameObject.name = AdvGame.UniqueName (cameraName + ": Background");
					_target.backgroundImage = newBackgroundImage;
				}
			}
			
			EditorGUILayout.EndHorizontal ();

			if (!_target.GetComponent <Camera>().orthographic)
			{
				EditorGUILayout.Space ();
				EditorGUILayout.LabelField ("Perspective offset", EditorStyles.boldLabel);
				_target.perspectiveOffset.x = EditorGUILayout.Slider ("Horizontal:", _target.perspectiveOffset.x, -0.05f, 0.05f);
				_target.perspectiveOffset.y = EditorGUILayout.Slider ("Vertical:", _target.perspectiveOffset.y, -0.05f, 0.05f);
			}

			EditorGUILayout.EndVertical ();

			if (_target.isActiveEditor)
			{
				UpdateCameraSnap (_target);
			}
			
			UnityVersionHandler.CustomSetDirty (_target);
		}
Esempio n. 4
0
        public override void OnInspectorGUI()
        {
            GameCamera25D _target = (GameCamera25D)target;

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Background image", EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal();
            _target.backgroundImage = (BackgroundImage)CustomGUILayout.ObjectField <BackgroundImage> ("Background:", _target.backgroundImage, true, "", "The BackgroundImage to display underneath all scene objects");

            if (_target.backgroundImage)
            {
                if (!Application.isPlaying && GUILayout.Button("Set as active", GUILayout.MaxWidth(90f)))
                {
                    Undo.RecordObject(_target, "Set active background");

                    _target.SetActiveBackground();
                }
            }
            else
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(90f)))
                {
                    Undo.RecordObject(_target, "Create Background Image");
                    BackgroundImage newBackgroundImage = SceneManager.AddPrefab("SetGeometry", "BackgroundImage", true, false, true).GetComponent <BackgroundImage>();

                    string cameraName = _target.gameObject.name;

                    newBackgroundImage.gameObject.name = AdvGame.UniqueName(cameraName + ": Background");
                    _target.backgroundImage            = newBackgroundImage;
                }
            }

            EditorGUILayout.EndHorizontal();

            if (MainCamera.AllowProjectionShifting(_target.GetComponent <Camera>()))
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Perspective offset", EditorStyles.boldLabel);
                _target.perspectiveOffset.x = CustomGUILayout.Slider("Horizontal:", _target.perspectiveOffset.x, -0.05f, 0.05f, "", "The horizontal offset in perspective from the camera's centre");
                _target.perspectiveOffset.y = CustomGUILayout.Slider("Vertical:", _target.perspectiveOffset.y, -0.05f, 0.05f, "", "The vertical offset in perspective from the camera's centre");
            }

            CustomGUILayout.EndVertical();

            if (_target.isActiveEditor)
            {
                _target.UpdateCameraSnap();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Esempio n. 5
0
        public override void OnInspectorGUI()
        {
            GameCamera25D _target = (GameCamera25D)target;

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Background image", EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal();
            _target.backgroundImage = (BackgroundImage)EditorGUILayout.ObjectField("Prefab:", _target.backgroundImage, typeof(BackgroundImage), true);

            if (_target.backgroundImage)
            {
                if (GUILayout.Button("Set as active", GUILayout.MaxWidth(90f)))
                {
                    Undo.RecordObject(_target, "Set active background");

                    _target.SetActiveBackground();
                    SnapCameraInEditor(_target);
                }
            }
            else
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(90f)))
                {
                    Undo.RecordObject(_target, "Create Background Image");
                    BackgroundImage newBackgroundImage = SceneManager.AddPrefab("SetGeometry", "BackgroundImage", true, false, true).GetComponent <BackgroundImage>();

                    string cameraName = _target.gameObject.name;

                    newBackgroundImage.gameObject.name = AdvGame.UniqueName(cameraName + ": Background");
                    _target.backgroundImage            = newBackgroundImage;
                }
            }

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();

            if (_target.isActiveEditor)
            {
                UpdateCameraSnap(_target);
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(_target);
            }
        }
Esempio n. 6
0
        public static Cutscene CutsceneGUI(string label, Cutscene cutscene, string defaultName = "", string api = "", string tooltip = "")
        {
            EditorGUILayout.BeginHorizontal();
            cutscene = (Cutscene)CustomGUILayout.ObjectField <Cutscene> (label, cutscene, true, api, tooltip);

            if (cutscene == null)
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                {
                    cutscene = SceneManager.AddPrefab("Logic", "Cutscene", true, false, true).GetComponent <Cutscene>();
                    cutscene.Initialise();

                    if (!string.IsNullOrEmpty(defaultName))
                    {
                        cutscene.gameObject.name = AdvGame.UniqueName(defaultName);
                    }
                }
            }

            EditorGUILayout.EndHorizontal();
            return(cutscene);
        }
Esempio n. 7
0
        private void ButtonGUI(Button button, string suffix, InteractionSource source)
        {
            bool isEnabled = !button.isDisabled;

            isEnabled         = EditorGUILayout.Toggle("Enabled:", isEnabled);
            button.isDisabled = !isEnabled;

            if (source == InteractionSource.AssetFile)
            {
                button.assetFile = (ActionListAsset)EditorGUILayout.ObjectField("Interaction:", button.assetFile, typeof(ActionListAsset), false);
            }
            else if (source == InteractionSource.CustomScript)
            {
                button.customScriptObject   = (GameObject)EditorGUILayout.ObjectField("Object with script:", button.customScriptObject, typeof(GameObject), true);
                button.customScriptFunction = EditorGUILayout.TextField("Message to send:", button.customScriptFunction);
            }
            else if (source == InteractionSource.InScene)
            {
                EditorGUILayout.BeginHorizontal();
                button.interaction = (Interaction)EditorGUILayout.ObjectField("Interaction:", button.interaction, typeof(Interaction), true);

                if (button.interaction == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        Undo.RecordObject(_target, "Create Interaction");
                        Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();

                        string hotspotName = _target.gameObject.name;
                        if (_target.hotspotName != "")
                        {
                            hotspotName = _target.hotspotName;
                        }

                        newInteraction.gameObject.name = AdvGame.UniqueName(hotspotName + ": " + suffix);
                        button.interaction             = newInteraction;
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            button.playerAction = (PlayerAction)EditorGUILayout.EnumPopup("Player action:", button.playerAction);

            if (button.playerAction == PlayerAction.WalkTo || button.playerAction == PlayerAction.WalkToMarker)
            {
                if (KickStarter.settingsManager == null || KickStarter.settingsManager.movementMethod != MovementMethod.UltimateFPS)
                {
                    button.isBlocking = EditorGUILayout.Toggle("Cutscene while moving?", button.isBlocking);
                }
                button.faceAfter = EditorGUILayout.Toggle("Face after moving?", button.faceAfter);

                if (button.playerAction == PlayerAction.WalkTo)
                {
                    button.setProximity = EditorGUILayout.Toggle("Set minimum distance?", button.setProximity);
                    if (button.setProximity)
                    {
                        button.proximity = EditorGUILayout.FloatField("Proximity:", button.proximity);
                    }
                }
            }
        }
Esempio n. 8
0
		private void NodeWindow (int ID)
		{
			if (ID == -2)
			{
				GUILayout.Label (lastConversation.gameObject.name);
			}
			else if (ID == -1)
			{
				GUILayout.Label (conversation.gameObject.name);
			}
			else if (ID < conversation.options.Count)
			{
				GUILayout.BeginHorizontal ();
				conversation.options[ID].label = GUILayout.TextField (conversation.options[ID].label);
				if (GUILayout.Button ("-", GUILayout.Width (20f)))
				{
					Undo.RecordObject (this, "Delete dialogue option");
					
					foreach (ButtonDialog option in conversation.options)
					{
						option.isEditing = false;
					}
					conversation.selectedOption = null;
					conversation.options.RemoveAt (ID);
				}
				GUILayout.EndHorizontal ();
			}
			else if (ID < conversation.options.Count * 2)
			{
				int i = ID - conversation.options.Count;
				if (conversation.interactionSource == InteractionSource.AssetFile)
				{
					conversation.options[i].assetFile = (ActionListAsset) EditorGUILayout.ObjectField (conversation.options[i].assetFile, typeof (ActionListAsset), false);
				}
				else if (conversation.interactionSource == InteractionSource.CustomScript)
				{
					GUILayout.Label ("(Set in Inspector)");
				}
				else if (conversation.interactionSource == InteractionSource.InScene)
				{
					if (conversation.options[i].dialogueOption != null)
					{
						GUILayout.BeginHorizontal ();

						string label = conversation.options[i].dialogueOption.gameObject.name;
						if (label.Length > 22)
						{
							label = label.Substring (0,22);
						}

						if (GUILayout.Button (label))
						{
							if (conversation.interactionSource == InteractionSource.InScene)
							{
								Selection.activeGameObject = conversation.options[i].dialogueOption.gameObject;
							}
						}

						if (GUILayout.Button ("", Resource.NodeSkin.customStyles[13]))
						{
							if (conversation.interactionSource == InteractionSource.InScene)
							{
								ActionListEditorWindow.Init (conversation.options[i].dialogueOption);
							}
							else
							{
								ActionListEditorWindow.Init (conversation.options[i].dialogueOption.assetFile);
							}
						}
						GUILayout.EndHorizontal ();
					}
					else
					{
						GUILayout.BeginHorizontal ();
						GUILayout.Label ("(Not set)");
						if (GUILayout.Button ("Create"))
						{
							Undo.RecordObject (conversation, "Auto-create dialogue option");
							DialogueOption newDialogueOption = SceneManager.AddPrefab ("Logic", "DialogueOption", true, false, true).GetComponent <DialogueOption>();
							
							newDialogueOption.gameObject.name = AdvGame.UniqueName (conversation.gameObject.name + "_Option");
							newDialogueOption.Initialise ();
							EditorUtility.SetDirty (newDialogueOption);
							conversation.options[i].dialogueOption = newDialogueOption;
						}
						GUILayout.EndHorizontal ();
					}
				}
			}
			else if (ID < conversation.options.Count * 3)
			{
				int i = ID - (conversation.options.Count*2);
				conversation.options[i].conversationAction = (ConversationAction) EditorGUILayout.EnumPopup (conversation.options[i].conversationAction);
			}
			else
			{
				int i = ID - (conversation.options.Count*3);
				if (conversation.options[i].newConversation != null)
				{
					conversation.options[i].newConversation = (Conversation) EditorGUILayout.ObjectField (conversation.options[i].newConversation, typeof (Conversation), true);
				}
				else
				{
					GUILayout.BeginHorizontal ();
					conversation.options[i].newConversation = (Conversation) EditorGUILayout.ObjectField (conversation.options[i].newConversation, typeof (Conversation), true);

					if (GUILayout.Button ("Create"))
					{
						Undo.RecordObject (conversation, "Auto-create conversation");
						Conversation newConversation = SceneManager.AddPrefab ("Logic", "Conversation", true, false, true).GetComponent <Conversation>();
						conversation.options[i].newConversation = newConversation;
					}
					GUILayout.EndHorizontal ();
				}
			}
		}
        public override void OnInspectorGUI()
        {
            Moveable_PickUp _target = (Moveable_PickUp)target;

            GetReferences();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Movment settings:", EditorStyles.boldLabel);
            _target.maxSpeed = EditorGUILayout.FloatField("Max speed:", _target.maxSpeed);
            _target.playerMovementReductionFactor = EditorGUILayout.Slider("Player movement reduction:", _target.playerMovementReductionFactor, 0f, 1f);
            _target.invertInput = EditorGUILayout.Toggle("Invert input?", _target.invertInput);
            _target.breakForce  = EditorGUILayout.FloatField("Break force:", _target.breakForce);
            _target.initialLift = EditorGUILayout.Slider("Initial lift:", _target.initialLift, 0f, 1f);

            EditorGUILayout.BeginHorizontal();
            _target.interactionOnGrab = (Interaction)EditorGUILayout.ObjectField("Interaction on grab:", _target.interactionOnGrab, typeof(Interaction), true);

            if (_target.interactionOnGrab == null)
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                {
                    Undo.RecordObject(_target, "Create Interaction");
                    Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();
                    newInteraction.gameObject.name = AdvGame.UniqueName("Move : " + _target.gameObject.name);
                    _target.interactionOnGrab      = newInteraction;
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Rotation settings:", EditorStyles.boldLabel);
            _target.allowRotation = EditorGUILayout.Toggle("Allow rotation?", _target.allowRotation);
            if (_target.allowRotation)
            {
                _target.rotationFactor = EditorGUILayout.FloatField("Rotation factor:", _target.rotationFactor);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Zoom settings:", EditorStyles.boldLabel);
            _target.allowZooming = EditorGUILayout.Toggle("Allow zooming?", _target.allowZooming);
            if (_target.allowZooming)
            {
                _target.zoomSpeed = EditorGUILayout.FloatField("Zoom speed:", _target.zoomSpeed);
                _target.minZoom   = EditorGUILayout.FloatField("Closest distance:", _target.minZoom);
                _target.maxZoom   = EditorGUILayout.FloatField("Farthest distance:", _target.maxZoom);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Throw settings:", EditorStyles.boldLabel);
            _target.allowThrow = EditorGUILayout.Toggle("Allow throwing?", _target.allowThrow);
            if (_target.allowThrow)
            {
                _target.throwForce       = EditorGUILayout.FloatField("Force scale:", _target.throwForce);
                _target.chargeTime       = EditorGUILayout.FloatField("Charge time:", _target.chargeTime);
                _target.pullbackDistance = EditorGUILayout.FloatField("Pull-back distance:", _target.pullbackDistance);
            }
            EditorGUILayout.EndVertical();

            SharedGUI(_target, false);

            DisplayInputList(_target);

            UnityVersionHandler.CustomSetDirty(_target);
        }
Esempio n. 10
0
        public override void OnInspectorGUI()
        {
            Moveable_Drag _target = (Moveable_Drag)target;

            GetReferences();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Movement settings:", EditorStyles.boldLabel);
            _target.maxSpeed = CustomGUILayout.FloatField("Max speed:", _target.maxSpeed, "", "The maximum force magnitude that can be applied to itself");
            _target.playerMovementReductionFactor = CustomGUILayout.Slider("Player motion reduction:", _target.playerMovementReductionFactor, 0f, 1f, "", "How much player movement is reduced by when the object is being dragged");
            _target.playerMovementInfluence       = CustomGUILayout.FloatField("Player motion influence:", _target.playerMovementInfluence, "", "The influence that player movement has on the drag force");
            _target.invertInput = CustomGUILayout.Toggle("Invert input?", _target.invertInput, "", "If True, input vectors will be inverted");
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");

            EditorGUILayout.LabelField("Drag settings:", EditorStyles.boldLabel);
            _target.dragMode = (DragMode)CustomGUILayout.EnumPopup("Drag mode:", _target.dragMode, "", "The way in which the object can be dragged");
            if (_target.dragMode == DragMode.LockToTrack)
            {
                _target.track = (DragTrack)CustomGUILayout.ObjectField <DragTrack> ("Track to stick to:", _target.track, true, "", "The DragTrack the object is locked to");

                if (_target.track != null && _target.track.UsesEndColliders && _target.GetComponent <SphereCollider>() == null)
                {
                    EditorGUILayout.HelpBox("For best results, ensure the first collider on this GameObject is a Sphere Collider covering the breath of the mesh.\r\nIt can be disabled if necessary, but will be used to set correct limit boundaries.", MessageType.Info);
                }

                _target.setOnStart = CustomGUILayout.ToggleLeft("Set starting position?", _target.setOnStart, "", "If True, then the object will be placed at a specific point along the track when the game begins");
                if (_target.setOnStart)
                {
                    _target.trackValueOnStart = CustomGUILayout.Slider("Initial distance along:", _target.trackValueOnStart, 0f, 1f, "", "How far along its DragTrack that the object should be placed at when the game begins");
                }
                _target.retainOriginalTransform = CustomGUILayout.ToggleLeft("Maintain original child transforms?", _target.retainOriginalTransform, "", "If True, then the position and rotation of all child objects will be maintained when the object is attached to the track");

                if (Application.isPlaying && _target.track != null)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Distance along: " + _target.GetPositionAlong().ToString(), EditorStyles.miniLabel);
                }

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.LabelField("Interactions", EditorStyles.boldLabel);

                _target.actionListSource = (ActionListSource)CustomGUILayout.EnumPopup("Actions source:", _target.actionListSource, "", "The source of the commands that are run when the object is interacted with");

                if (_target.actionListSource == ActionListSource.InScene)
                {
                    EditorGUILayout.BeginHorizontal();
                    _target.interactionOnMove = (Interaction)CustomGUILayout.ObjectField <Interaction> ("Interaction on move:", _target.interactionOnMove, true, "", "The Interaction to run whenever the object is moved by the player");
                    if (_target.interactionOnMove == null)
                    {
                        if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                        {
                            Undo.RecordObject(_target, "Create Interaction");
                            Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();
                            newInteraction.gameObject.name = AdvGame.UniqueName("Move : " + _target.gameObject.name);
                            _target.interactionOnMove      = newInteraction;
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    if (_target.interactionOnMove != null && _target.interactionOnMove.source == ActionListSource.InScene && _target.interactionOnMove.useParameters && _target.interactionOnMove.parameters.Count > 0)
                    {
                        EditorGUILayout.BeginHorizontal();
                        _target.moveParameterID = Action.ChooseParameterGUI("Drag parameter:", _target.interactionOnMove.parameters, _target.moveParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this draggable object");
                        EditorGUILayout.EndHorizontal();
                    }
                    else if (_target.interactionOnMove != null && _target.interactionOnMove.source == ActionListSource.AssetFile && _target.interactionOnMove.assetFile != null && _target.interactionOnMove.assetFile.useParameters && _target.interactionOnMove.assetFile.parameters.Count > 0)
                    {
                        EditorGUILayout.BeginHorizontal();
                        _target.moveParameterID = Action.ChooseParameterGUI("Drag parameter:", _target.interactionOnMove.assetFile.parameters, _target.moveParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this draggable object");
                        EditorGUILayout.EndHorizontal();
                    }

                    EditorGUILayout.BeginHorizontal();
                    _target.interactionOnDrop = (Interaction)CustomGUILayout.ObjectField <Interaction> ("Interaction on let go:", _target.interactionOnDrop, true, "", "The Interaction to run whenever the object is let go by the player");
                    if (_target.interactionOnDrop == null)
                    {
                        if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                        {
                            Undo.RecordObject(_target, "Create Interaction");
                            Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();
                            newInteraction.gameObject.name = AdvGame.UniqueName("LetGo : " + _target.gameObject.name);
                            _target.interactionOnDrop      = newInteraction;
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    if (_target.interactionOnDrop != null)
                    {
                        if (_target.interactionOnDrop.source == ActionListSource.InScene && _target.interactionOnDrop.useParameters && _target.interactionOnDrop.parameters.Count > 0)
                        {
                            EditorGUILayout.BeginHorizontal();
                            _target.dropParameterID = Action.ChooseParameterGUI("PickUp parameter:", _target.interactionOnDrop.parameters, _target.moveParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this pickup object");
                            EditorGUILayout.EndHorizontal();
                        }
                        else if (_target.interactionOnDrop.source == ActionListSource.AssetFile && _target.interactionOnDrop.assetFile != null && _target.interactionOnDrop.assetFile.useParameters && _target.interactionOnDrop.assetFile.parameters.Count > 0)
                        {
                            EditorGUILayout.BeginHorizontal();
                            _target.dropParameterID = Action.ChooseParameterGUI("PickUp parameter:", _target.interactionOnDrop.assetFile.parameters, _target.dropParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this pickup object");
                            EditorGUILayout.EndHorizontal();
                        }
                    }
                }
                else if (_target.actionListSource == ActionListSource.AssetFile)
                {
                    _target.actionListAssetOnMove = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("Interaction on move:", _target.actionListAssetOnMove, true, "", "The ActionList asset to run whenever the object is moved by the player");

                    if (_target.actionListAssetOnMove != null && _target.actionListAssetOnMove.useParameters && _target.actionListAssetOnMove.parameters.Count > 0)
                    {
                        EditorGUILayout.BeginHorizontal();
                        _target.moveParameterID = Action.ChooseParameterGUI("Drag parameter:", _target.actionListAssetOnMove.parameters, _target.moveParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this draggable object");
                        EditorGUILayout.EndHorizontal();
                    }

                    _target.actionListAssetOnDrop = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("Interaction on let go:", _target.actionListAssetOnDrop, true, "", "The ActionList asset to run whenever the object is let go by the player");

                    if (_target.actionListAssetOnDrop != null && _target.actionListAssetOnDrop.useParameters && _target.actionListAssetOnDrop.parameters.Count > 0)
                    {
                        EditorGUILayout.BeginHorizontal();
                        _target.dropParameterID = Action.ChooseParameterGUI("Drag parameter:", _target.actionListAssetOnDrop.parameters, _target.dropParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this draggable object");
                        EditorGUILayout.EndHorizontal();
                    }
                }
            }
            else if (_target.dragMode == DragMode.MoveAlongPlane)
            {
                _target.alignMovement = (AlignDragMovement)CustomGUILayout.EnumPopup("Align movement:", _target.alignMovement, "", "What movement is aligned to");
                if (_target.alignMovement == AlignDragMovement.AlignToPlane)
                {
                    _target.plane = (Transform)CustomGUILayout.ObjectField <Transform> ("Movement plane:", _target.plane, true, "", "The plane to align movement to");
                }
                _target.noGravityWhenHeld = CustomGUILayout.Toggle("Disable gravity when held?", _target.noGravityWhenHeld, "", "If True, then gravity will be disabled on the object while it is held by the player");
            }
            else if (_target.dragMode == DragMode.RotateOnly)
            {
                _target.rotationFactor = CustomGUILayout.FloatField("Rotation factor:", _target.rotationFactor, "", "The speed by which the object can be rotated");
                _target.allowZooming   = CustomGUILayout.Toggle("Allow zooming?", _target.allowZooming, "", "If True, the object can be moved towards and away from the camera");
                if (_target.allowZooming)
                {
                    _target.zoomSpeed = CustomGUILayout.FloatField("Zoom speed:", _target.zoomSpeed, "", "The speed at which the object can be moved towards and away from the camera");
                    _target.minZoom   = CustomGUILayout.FloatField("Closest distance:", _target.minZoom, "", "The minimum distance that there can be between the object and the camera");
                    _target.maxZoom   = CustomGUILayout.FloatField("Farthest distance:", _target.maxZoom, "", "The maximum distance that there can be between the object and the camera");
                }
                _target.noGravityWhenHeld = CustomGUILayout.Toggle("Disable gravity when held?", _target.noGravityWhenHeld, "", "If True, then gravity will be disabled on the object while it is held by the player");
            }

            EditorGUILayout.EndVertical();

            if (_target.dragMode == DragMode.LockToTrack && _target.track is DragTrack_Hinge)
            {
                SharedGUI(_target, true);
            }
            else
            {
                SharedGUI(_target, false);
            }

            DisplayInputList(_target);

            UnityVersionHandler.CustomSetDirty(_target);
        }
Esempio n. 11
0
        public override void OnInspectorGUI()
        {
            Moveable_Drag _target = (Moveable_Drag)target;

            GetReferences();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Movment settings:", EditorStyles.boldLabel);
            _target.maxSpeed = EditorGUILayout.FloatField("Max speed:", _target.maxSpeed);
            _target.playerMovementReductionFactor = EditorGUILayout.Slider("Player movement reduction:", _target.playerMovementReductionFactor, 0f, 1f);
            _target.playerMovementInfluence       = EditorGUILayout.FloatField("Player movement influence:", _target.playerMovementInfluence);
            _target.invertInput = EditorGUILayout.Toggle("Invert input?", _target.invertInput);
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");

            EditorGUILayout.LabelField("Drag settings:", EditorStyles.boldLabel);
            _target.dragMode = (DragMode)EditorGUILayout.EnumPopup("Drag mode:", _target.dragMode);
            if (_target.dragMode == DragMode.LockToTrack)
            {
                _target.track = (DragTrack)EditorGUILayout.ObjectField("Track to stick to:", _target.track, typeof(DragTrack), true);

                if (_target.track != null && _target.track is DragTrack_Straight)
                {
                    EditorGUILayout.HelpBox("For best results, ensure the first collider on this GameObject is a Sphere Collider covering the breath of the mesh.\r\nIt can be disabled if necessary, but will be used to set correct limit boundaries.", MessageType.Info);
                }

                _target.setOnStart = EditorGUILayout.Toggle("Set starting position?", _target.setOnStart);
                if (_target.setOnStart)
                {
                    _target.trackValueOnStart = EditorGUILayout.Slider("Initial distance along:", _target.trackValueOnStart, 0f, 1f);
                }
                _target.retainOriginalTransform = EditorGUILayout.ToggleLeft("Maintain original child transforms?", _target.retainOriginalTransform);

                EditorGUILayout.BeginHorizontal();
                _target.interactionOnMove = (Interaction)EditorGUILayout.ObjectField("Interaction on move:", _target.interactionOnMove, typeof(Interaction), true);

                if (_target.interactionOnMove == null)
                {
                    if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                    {
                        Undo.RecordObject(_target, "Create Interaction");
                        Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();
                        newInteraction.gameObject.name = AdvGame.UniqueName("Move : " + _target.gameObject.name);
                        _target.interactionOnMove      = newInteraction;
                    }
                }
                EditorGUILayout.EndVertical();
            }
            else if (_target.dragMode == DragMode.MoveAlongPlane)
            {
                _target.alignMovement = (AlignDragMovement)EditorGUILayout.EnumPopup("Align movement:", _target.alignMovement);
                if (_target.alignMovement == AlignDragMovement.AlignToPlane)
                {
                    _target.plane = (Transform)EditorGUILayout.ObjectField("Movement plane:", _target.plane, typeof(Transform), true);
                }
            }
            else if (_target.dragMode == DragMode.RotateOnly)
            {
                _target.rotationFactor = EditorGUILayout.FloatField("Rotation factor:", _target.rotationFactor);
                _target.allowZooming   = EditorGUILayout.Toggle("Allow zooming?", _target.allowZooming);
                if (_target.allowZooming)
                {
                    _target.zoomSpeed = EditorGUILayout.FloatField("Zoom speed:", _target.zoomSpeed);
                    _target.minZoom   = EditorGUILayout.FloatField("Closest distance:", _target.minZoom);
                    _target.maxZoom   = EditorGUILayout.FloatField("Farthest distance:", _target.maxZoom);
                }
            }

            if (_target.dragMode != DragMode.LockToTrack)
            {
                _target.noGravityWhenHeld = EditorGUILayout.Toggle("Disable gravity when held?", _target.noGravityWhenHeld);
            }

            if (Application.isPlaying && _target.dragMode == DragMode.LockToTrack && _target.track)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Distance along: " + _target.GetPositionAlong().ToString(), EditorStyles.miniLabel);
            }

            EditorGUILayout.EndVertical();

            if (_target.dragMode == DragMode.LockToTrack && _target.track is DragTrack_Hinge)
            {
                SharedGUI(_target, true);
            }
            else
            {
                SharedGUI(_target, false);
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Esempio n. 12
0
        private void EditOptionGUI(ButtonDialog option, InteractionSource source)
        {
            CustomGUILayout.BeginVertical();

            if (option.lineID > -1)
            {
                EditorGUILayout.LabelField("Speech Manager ID:", option.lineID.ToString());
            }

            option.label = CustomGUILayout.TextField("Label:", option.label, "", "The option's display label");

            if (source == InteractionSource.AssetFile)
            {
                option.assetFile = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("Interaction:", option.assetFile, false, "", "The ActionListAsset to run");
            }
            else if (source == InteractionSource.CustomScript)
            {
                option.customScriptObject   = (GameObject)CustomGUILayout.ObjectField <GameObject> ("Object with script:", option.customScriptObject, true, "", "The GameObject with the custom script to run");
                option.customScriptFunction = CustomGUILayout.TextField("Message to send:", option.customScriptFunction, "", "The name of the function to run");
            }
            else if (source == InteractionSource.InScene)
            {
                EditorGUILayout.BeginHorizontal();
                option.dialogueOption = (DialogueOption)CustomGUILayout.ObjectField <DialogueOption> ("DialogOption:", option.dialogueOption, true, "", "The DialogOption to run");
                if (option.dialogueOption == null)
                {
                    if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                    {
                        Undo.RecordObject(_target, "Auto-create dialogue option");
                        DialogueOption newDialogueOption = SceneManager.AddPrefab("Logic", "DialogueOption", true, false, true).GetComponent <DialogueOption>();

                        newDialogueOption.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + "_Option");
                        newDialogueOption.Initialise();
                        EditorUtility.SetDirty(newDialogueOption);
                        option.dialogueOption = newDialogueOption;
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            option.cursorIcon.ShowGUI(false, true, "Icon texture:", CursorRendering.Software, "", "The icon to display in DialogList menu elements");

            option.isOn = CustomGUILayout.Toggle("Is enabled?", option.isOn, "", "If True, the option is enabled, and will be displayed in a MenuDialogList element");
            if (source == InteractionSource.CustomScript)
            {
                EditorGUILayout.HelpBox("Using a custom script will cause the conversation to end when finished, unless it is re-run explicitly.", MessageType.Info);
            }
            else
            {
                option.conversationAction = (ConversationAction)CustomGUILayout.EnumPopup("When finished:", option.conversationAction, "", "What happens when the DialogueOption ActionList has finished");
                if (option.conversationAction == AC.ConversationAction.RunOtherConversation)
                {
                    option.newConversation = (Conversation)CustomGUILayout.ObjectField <Conversation> ("Conversation to run:", option.newConversation, true, "", "The new Conversation to run");
                }
            }

            option.linkToInventory = CustomGUILayout.ToggleLeft("Only show if carrying specific inventory item?", option.linkToInventory, "", " If True, then the option will only be visible if a given inventory item is being carried");
            if (option.linkToInventory)
            {
                option.linkedInventoryID = CreateInventoryGUI(option.linkedInventoryID);
            }

            CustomGUILayout.EndVertical();
        }
Esempio n. 13
0
        private void ButtonGUI(Button button, string suffix, InteractionSource source, bool isForInventory = false)
        {
            bool isEnabled = !button.isDisabled;

            isEnabled         = EditorGUILayout.Toggle("Enabled:", isEnabled);
            button.isDisabled = !isEnabled;

            if (source == InteractionSource.AssetFile)
            {
                EditorGUILayout.BeginHorizontal();
                button.assetFile = (ActionListAsset)EditorGUILayout.ObjectField("Interaction:", button.assetFile, typeof(ActionListAsset), false);
                if (button.assetFile != null && GUILayout.Button("", Resource.NodeSkin.customStyles[13], GUILayout.Width(20f)))
                {
                    ActionListEditorWindow.Init(button.assetFile);
                }
                EditorGUILayout.EndHorizontal();

                if (button.assetFile != null && button.assetFile.useParameters && button.assetFile.parameters.Count > 0)
                {
                    EditorGUILayout.BeginHorizontal();
                    button.parameterID = Action.ChooseParameterGUI("Hotspot parameter:", button.assetFile.parameters, button.parameterID, ParameterType.GameObject);
                    EditorGUILayout.EndHorizontal();

                    if (button.parameterID >= 0 && _target.GetComponent <ConstantID>() == null)
                    {
                        EditorGUILayout.HelpBox("A Constant ID component must be added to the Hotspot in order for it to be passed as a parameter.", MessageType.Warning);
                    }
                }
            }
            else if (source == InteractionSource.CustomScript)
            {
                button.customScriptObject   = (GameObject)EditorGUILayout.ObjectField("Object with script:", button.customScriptObject, typeof(GameObject), true);
                button.customScriptFunction = EditorGUILayout.TextField("Message to send:", button.customScriptFunction);

                if (isForInventory)
                {
                    EditorGUILayout.HelpBox("If the receiving function has an integer parameter, the Inventory item's ID will be passed to it.", MessageType.Info);
                }
            }
            else if (source == InteractionSource.InScene)
            {
                EditorGUILayout.BeginHorizontal();
                button.interaction = (Interaction)EditorGUILayout.ObjectField("Interaction:", button.interaction, typeof(Interaction), true);

                if (button.interaction == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        Undo.RecordObject(_target, "Create Interaction");
                        Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();

                        string hotspotName = _target.gameObject.name;
                        if (_target != null && _target.hotspotName != null && _target.hotspotName.Length > 0)
                        {
                            hotspotName = _target.hotspotName;
                        }

                        newInteraction.gameObject.name = AdvGame.UniqueName(hotspotName + ": " + suffix);
                        button.interaction             = newInteraction;
                    }
                }
                else
                {
                    if (GUILayout.Button("", Resource.NodeSkin.customStyles[13], GUILayout.Width(20f)))
                    {
                        ActionListEditorWindow.Init(button.interaction);
                    }
                }
                EditorGUILayout.EndHorizontal();

                if (button.interaction != null && button.interaction.useParameters && button.interaction.parameters.Count > 0)
                {
                    EditorGUILayout.BeginHorizontal();
                    button.parameterID = Action.ChooseParameterGUI("Hotspot parameter:", button.interaction.parameters, button.parameterID, ParameterType.GameObject);
                    EditorGUILayout.EndHorizontal();
                }
            }

            button.playerAction = (PlayerAction)EditorGUILayout.EnumPopup("Player action:", button.playerAction);

            if (button.playerAction == PlayerAction.WalkTo || button.playerAction == PlayerAction.WalkToMarker)
            {
                if (button.playerAction == PlayerAction.WalkToMarker && _target.walkToMarker == null)
                {
                    EditorGUILayout.HelpBox("You must assign a 'Walk-to marker' above for this option to work.", MessageType.Warning);
                }
                button.isBlocking = EditorGUILayout.Toggle("Cutscene while moving?", button.isBlocking);
                button.faceAfter  = EditorGUILayout.Toggle("Face after moving?", button.faceAfter);

                if (button.playerAction == PlayerAction.WalkTo)
                {
                    button.setProximity = EditorGUILayout.Toggle("Set minimum distance?", button.setProximity);
                    if (button.setProximity)
                    {
                        button.proximity = EditorGUILayout.FloatField("Proximity:", button.proximity);
                    }
                }
            }
        }
Esempio n. 14
0
        public override void OnInspectorGUI()
        {
            Moveable_Drag _target = (Moveable_Drag)target;

            GetReferences();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Movment settings:", EditorStyles.boldLabel);
            _target.maxSpeed    = EditorGUILayout.FloatField("Max speed:", _target.maxSpeed);
            _target.invertInput = EditorGUILayout.Toggle("Invert input?", _target.invertInput);
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");

            EditorGUILayout.LabelField("Drag settings:", EditorStyles.boldLabel);
            _target.dragMode = (DragMode)EditorGUILayout.EnumPopup("Drag mode:", _target.dragMode);
            if (_target.dragMode == DragMode.LockToTrack)
            {
                _target.track      = (DragTrack)EditorGUILayout.ObjectField("Track to stick to:", _target.track, typeof(DragTrack), true);
                _target.setOnStart = EditorGUILayout.Toggle("Set starting position?", _target.setOnStart);
                if (_target.setOnStart)
                {
                    _target.trackValueOnStart = EditorGUILayout.Slider("Initial distance along:", _target.trackValueOnStart, 0f, 1f);
                }

                EditorGUILayout.BeginHorizontal();
                _target.interactionOnMove = (Interaction)EditorGUILayout.ObjectField("Interaction on move:", _target.interactionOnMove, typeof(Interaction), true);

                if (_target.interactionOnMove == null)
                {
                    if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                    {
                        Undo.RecordObject(_target, "Create Interaction");
                        Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();
                        newInteraction.gameObject.name = AdvGame.UniqueName("Move : " + _target.gameObject.name);
                        _target.interactionOnMove      = newInteraction;
                    }
                }
                EditorGUILayout.EndVertical();
            }
            else if (_target.dragMode == DragMode.MoveAlongPlane)
            {
                _target.alignMovement = (AlignDragMovement)EditorGUILayout.EnumPopup("Align movement:", _target.alignMovement);
                if (_target.alignMovement == AlignDragMovement.AlignToPlane)
                {
                    _target.plane = (Transform)EditorGUILayout.ObjectField("Movement plane:", _target.plane, typeof(Transform), true);
                }
            }
            else if (_target.dragMode == DragMode.RotateOnly)
            {
                _target.rotationFactor = EditorGUILayout.FloatField("Rotation factor:", _target.rotationFactor);
                _target.allowZooming   = EditorGUILayout.Toggle("Allow zooming?", _target.allowZooming);
                if (_target.allowZooming)
                {
                    _target.zoomSpeed = EditorGUILayout.FloatField("Zoom speed:", _target.zoomSpeed);
                    _target.minZoom   = EditorGUILayout.FloatField("Closest distance:", _target.minZoom);
                    _target.maxZoom   = EditorGUILayout.FloatField("Farthest distance:", _target.maxZoom);
                }
            }

            if (_target.dragMode != DragMode.LockToTrack)
            {
                _target.noGravityWhenHeld = EditorGUILayout.Toggle("Disable gravity when held?", _target.noGravityWhenHeld);
            }

            if (Application.isPlaying && _target.dragMode == DragMode.LockToTrack && _target.track)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Distance along: " + _target.GetPositionAlong().ToString(), EditorStyles.miniLabel);
            }

            EditorGUILayout.EndVertical();

            if (_target.dragMode == DragMode.LockToTrack && _target.track is DragTrack_Hinge)
            {
                SharedGUI(_target, true);
            }
            else
            {
                SharedGUI(_target, false);
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(_target);
            }
        }
        public override void OnInspectorGUI()
        {
            Moveable_PickUp _target = (Moveable_PickUp)target;

            GetReferences();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Movment settings:", EditorStyles.boldLabel);
            _target.maxSpeed = CustomGUILayout.FloatField("Max speed:", _target.maxSpeed, "", "The maximum force magnitude that can be applied to itself");
            _target.playerMovementReductionFactor = CustomGUILayout.Slider("Player movement reduction:", _target.playerMovementReductionFactor, 0f, 1f, "", "How much player movement is reduced by when the object is being dragged");
            _target.invertInput = CustomGUILayout.Toggle("Invert input?", _target.invertInput, "", "If True, input vectors will be inverted");
            _target.breakForce  = CustomGUILayout.FloatField("Break force:", _target.breakForce, "", "The maximum force magnitude that can be applied by the player - if exceeded, control will be removed");
            _target.initialLift = CustomGUILayout.Slider("Initial lift:", _target.initialLift, 0f, 1f, "", "The lift to give objects picked up, so that they aren't touching the ground when initially held");

            EditorGUILayout.BeginHorizontal();
            _target.interactionOnGrab = (Interaction)CustomGUILayout.ObjectField <Interaction> ("Interaction on grab:", _target.interactionOnGrab, true, "", "The Interaction to run whenever the object is picked up by the player");

            if (_target.interactionOnGrab == null)
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                {
                    Undo.RecordObject(_target, "Create Interaction");
                    Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();
                    newInteraction.gameObject.name = AdvGame.UniqueName("Move : " + _target.gameObject.name);
                    _target.interactionOnGrab      = newInteraction;
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Rotation settings:", EditorStyles.boldLabel);
            _target.allowRotation = CustomGUILayout.Toggle("Allow rotation?", _target.allowRotation, "", "If True, the object can be rotated");
            if (_target.allowRotation)
            {
                _target.rotationFactor = CustomGUILayout.FloatField("Rotation factor:", _target.rotationFactor, "", "The speed by which the object can be rotated");
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Zoom settings:", EditorStyles.boldLabel);
            _target.allowZooming = CustomGUILayout.Toggle("Allow zooming?", _target.allowZooming, "", "If True, the object can be moved towards and away from the camera");
            if (_target.allowZooming)
            {
                _target.zoomSpeed = CustomGUILayout.FloatField("Zoom speed:", _target.zoomSpeed, "", "The speed at which the object can be moved towards and away from the camera");
                _target.minZoom   = CustomGUILayout.FloatField("Closest distance:", _target.minZoom, "", "The minimum distance that there can be between the object and the camera");
                _target.maxZoom   = CustomGUILayout.FloatField("Farthest distance:", _target.maxZoom, "", "The maximum distance that there can be between the object and the camera");
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Throw settings:", EditorStyles.boldLabel);
            _target.allowThrow = CustomGUILayout.Toggle("Allow throwing?", _target.allowThrow, "", "If True, the object can be thrown");
            if (_target.allowThrow)
            {
                _target.throwForce       = CustomGUILayout.FloatField("Force scale:", _target.throwForce, "", "How far the object can be thrown");
                _target.chargeTime       = CustomGUILayout.FloatField("Charge time:", _target.chargeTime, "", "How long a 'charge' takes, if the object cen be thrown");
                _target.pullbackDistance = CustomGUILayout.FloatField("Pull-back distance:", _target.pullbackDistance, "", "How far the object is pulled back while chargine, if the object can be thrown");
            }
            EditorGUILayout.EndVertical();

            SharedGUI(_target, false);

            DisplayInputList(_target);

            UnityVersionHandler.CustomSetDirty(_target);
        }
Esempio n. 16
0
        private void EditOptionGUI(ButtonDialog option, InteractionSource source)
        {
            EditorGUILayout.BeginVertical("Button");

            if (option.lineID > -1)
            {
                EditorGUILayout.LabelField("Speech Manager ID:", option.lineID.ToString());
            }

            option.label = EditorGUILayout.TextField("Label:", option.label);

            if (source == InteractionSource.AssetFile)
            {
                option.assetFile = (ActionListAsset)EditorGUILayout.ObjectField("Interaction:", option.assetFile, typeof(ActionListAsset), false);
            }
            else if (source == InteractionSource.CustomScript)
            {
                option.customScriptObject   = (GameObject)EditorGUILayout.ObjectField("Object with script:", option.customScriptObject, typeof(GameObject), true);
                option.customScriptFunction = EditorGUILayout.TextField("Message to send:", option.customScriptFunction);
            }
            else if (source == InteractionSource.InScene)
            {
                EditorGUILayout.BeginHorizontal();
                option.dialogueOption = (DialogueOption)EditorGUILayout.ObjectField("Interaction:", option.dialogueOption, typeof(DialogueOption), true);
                if (option.dialogueOption == null)
                {
                    if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                    {
                        Undo.RecordObject(_target, "Auto-create dialogue option");
                        DialogueOption newDialogueOption = SceneManager.AddPrefab("Logic", "DialogueOption", true, false, true).GetComponent <DialogueOption>();

                        newDialogueOption.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + "_Option");
                        newDialogueOption.Initialise();
                        EditorUtility.SetDirty(newDialogueOption);
                        option.dialogueOption = newDialogueOption;
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            option.cursorIcon.ShowGUI(false, true, "Icon texture:");

            option.isOn = EditorGUILayout.Toggle("Is enabled?", option.isOn);
            if (source == InteractionSource.CustomScript)
            {
                EditorGUILayout.HelpBox("Using a custom script will cause the conversation to end when finished, unless it is re-run explicitly.", MessageType.Info);
            }
            else
            {
                option.conversationAction = (ConversationAction)EditorGUILayout.EnumPopup("When finished:", option.conversationAction);
                if (option.conversationAction == AC.ConversationAction.RunOtherConversation)
                {
                    option.newConversation = (Conversation)EditorGUILayout.ObjectField("Conversation to run:", option.newConversation, typeof(Conversation), true);
                }
            }

            option.linkToInventory = EditorGUILayout.ToggleLeft("Only show if carrying specific inventory item?", option.linkToInventory);
            if (option.linkToInventory)
            {
                option.linkedInventoryID = CreateInventoryGUI(option.linkedInventoryID);
            }

            EditorGUILayout.EndVertical();
        }
Esempio n. 17
0
        public override void OnInspectorGUI()
        {
            Moveable_PickUp _target = (Moveable_PickUp)target;

            GetReferences();

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Movement settings:", EditorStyles.boldLabel);
            _target.maxSpeed = CustomGUILayout.FloatField("Max speed:", _target.maxSpeed, string.Empty, "The maximum force magnitude that can be applied to itself");
            _target.playerMovementReductionFactor = CustomGUILayout.Slider("Player movement reduction:", _target.playerMovementReductionFactor, 0f, 1f, string.Empty, "How much player movement is reduced by when the object is being dragged");
            _target.invertInput        = CustomGUILayout.Toggle("Invert input?", _target.invertInput, string.Empty, "If True, input vectors will be inverted");
            _target.breakForce         = CustomGUILayout.FloatField("Break force:", _target.breakForce, string.Empty, "The maximum force magnitude that can be applied by the player - if exceeded, control will be removed");
            _target.initialLift        = CustomGUILayout.Slider("Initial lift:", _target.initialLift, 0f, 1f, string.Empty, "The lift to give objects picked up, so that they aren't touching the ground when initially held");
            _target.autoSetConstraints = CustomGUILayout.Toggle("Auto set RB constraints?", _target.autoSetConstraints, string.Empty, "If True, the Rigidbody's constraints will be set automatically based on the state of the interaction.");

            _target.offScreenRelease = (OffScreenRelease)CustomGUILayout.EnumPopup("Off-screen release:", _target.offScreenRelease, string.Empty, "What should cause the object to be automatically released upon leaving the screen");

            CustomGUILayout.EndVertical();

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Interactions", EditorStyles.boldLabel);

            _target.actionListSource = (ActionListSource)CustomGUILayout.EnumPopup("Actions source:", _target.actionListSource, string.Empty, "The source of the commands that are run when the object is interacted with");

            if (_target.actionListSource == ActionListSource.InScene)
            {
                EditorGUILayout.BeginHorizontal();
                _target.interactionOnGrab = (Interaction)CustomGUILayout.ObjectField <Interaction> ("Interaction on move:", _target.interactionOnGrab, true, string.Empty, "The Interaction to run whenever the object is moved by the player");
                if (_target.interactionOnGrab == null)
                {
                    if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                    {
                        Undo.RecordObject(_target, "Create Interaction");
                        Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();
                        newInteraction.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + ": Grab");
                        _target.interactionOnGrab      = newInteraction;
                    }
                }
                EditorGUILayout.EndHorizontal();

                if (_target.interactionOnGrab != null && _target.interactionOnGrab.source == ActionListSource.InScene && _target.interactionOnGrab.NumParameters > 0)
                {
                    EditorGUILayout.BeginHorizontal();
                    _target.moveParameterID = Action.ChooseParameterGUI("PickUp parameter:", _target.interactionOnGrab.parameters, _target.moveParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this pickup object");
                    EditorGUILayout.EndHorizontal();
                }
                else if (_target.interactionOnGrab != null && _target.interactionOnGrab.source == ActionListSource.AssetFile && _target.interactionOnGrab.assetFile != null && _target.interactionOnGrab.assetFile.NumParameters > 0)
                {
                    EditorGUILayout.BeginHorizontal();
                    _target.moveParameterID = Action.ChooseParameterGUI("PickUp parameter:", _target.interactionOnGrab.assetFile.DefaultParameters, _target.moveParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this pickup object");
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUILayout.BeginHorizontal();
                _target.interactionOnDrop = (Interaction)CustomGUILayout.ObjectField <Interaction> ("Interaction on let go:", _target.interactionOnDrop, true, string.Empty, "The Interaction to run whenever the object is let go by the player");
                if (_target.interactionOnDrop == null)
                {
                    if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                    {
                        Undo.RecordObject(_target, "Create Interaction");
                        Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();
                        newInteraction.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + ": LetGo");
                        _target.interactionOnDrop      = newInteraction;
                    }
                }
                EditorGUILayout.EndHorizontal();

                if (_target.interactionOnDrop)
                {
                    if (_target.interactionOnDrop.source == ActionListSource.InScene && _target.interactionOnDrop.NumParameters > 0)
                    {
                        EditorGUILayout.BeginHorizontal();
                        _target.dropParameterID = Action.ChooseParameterGUI("PickUp parameter:", _target.interactionOnDrop.parameters, _target.moveParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this pickup object");
                        EditorGUILayout.EndHorizontal();
                    }
                    else if (_target.interactionOnDrop.source == ActionListSource.AssetFile && _target.interactionOnDrop.assetFile != null && _target.interactionOnDrop.assetFile.NumParameters > 0)
                    {
                        EditorGUILayout.BeginHorizontal();
                        _target.dropParameterID = Action.ChooseParameterGUI("PickUp parameter:", _target.interactionOnDrop.assetFile.DefaultParameters, _target.dropParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this pickup object");
                        EditorGUILayout.EndHorizontal();
                    }
                }
            }
            else if (_target.actionListSource == ActionListSource.AssetFile)
            {
                _target.actionListAssetOnGrab = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("Interaction on grab:", _target.actionListAssetOnGrab, true, string.Empty, "The ActionList asset to run whenever the object is moved by the player");

                if (_target.actionListAssetOnGrab != null && _target.actionListAssetOnGrab.NumParameters > 0)
                {
                    EditorGUILayout.BeginHorizontal();
                    _target.moveParameterID = Action.ChooseParameterGUI("PickUp parameter:", _target.actionListAssetOnGrab.DefaultParameters, _target.moveParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this pickup object");
                    EditorGUILayout.EndHorizontal();
                }

                _target.actionListAssetOnDrop = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("Interaction on let go:", _target.actionListAssetOnDrop, true, string.Empty, "The ActionList asset to run whenever the object is let go by the player");

                if (_target.actionListAssetOnDrop != null && _target.actionListAssetOnDrop.NumParameters > 0)
                {
                    EditorGUILayout.BeginHorizontal();
                    _target.dropParameterID = Action.ChooseParameterGUI("PickUp parameter:", _target.actionListAssetOnDrop.DefaultParameters, _target.dropParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this pickup object");
                    EditorGUILayout.EndHorizontal();
                }
            }
            CustomGUILayout.EndVertical();

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Rotation settings:", EditorStyles.boldLabel);
            _target.allowRotation = CustomGUILayout.Toggle("Allow rotation?", _target.allowRotation, string.Empty, "If True, the object can be rotated");
            if (_target.allowRotation)
            {
                _target.rotationFactor = CustomGUILayout.FloatField("Rotation factor:", _target.rotationFactor, string.Empty, "The speed by which the object can be rotated");
            }
            CustomGUILayout.EndVertical();

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Zoom settings:", EditorStyles.boldLabel);
            _target.allowZooming = CustomGUILayout.Toggle("Allow zooming?", _target.allowZooming, string.Empty, "If True, the object can be moved towards and away from the camera");
            if (_target.allowZooming)
            {
                _target.zoomSpeed = CustomGUILayout.FloatField("Zoom speed:", _target.zoomSpeed, string.Empty, "The speed at which the object can be moved towards and away from the camera");
                _target.minZoom   = CustomGUILayout.FloatField("Closest distance:", _target.minZoom, string.Empty, "The minimum distance that there can be between the object and the camera");
                _target.maxZoom   = CustomGUILayout.FloatField("Farthest distance:", _target.maxZoom, string.Empty, "The maximum distance that there can be between the object and the camera");
            }
            CustomGUILayout.EndVertical();

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Throw settings:", EditorStyles.boldLabel);
            _target.allowThrow = CustomGUILayout.Toggle("Allow throwing?", _target.allowThrow, string.Empty, "If True, the object can be thrown");
            if (_target.allowThrow)
            {
                _target.throwForce       = CustomGUILayout.FloatField("Force scale:", _target.throwForce, string.Empty, "How far the object can be thrown");
                _target.chargeTime       = CustomGUILayout.FloatField("Charge time:", _target.chargeTime, string.Empty, "How long a 'charge' takes, if the object cen be thrown");
                _target.pullbackDistance = CustomGUILayout.FloatField("Pull-back distance:", _target.pullbackDistance, string.Empty, "How far the object is pulled back while chargine, if the object can be thrown");
            }
            CustomGUILayout.EndVertical();

            SharedGUI(_target, false);

            DisplayInputList(_target);

            UnityVersionHandler.CustomSetDirty(_target);
        }