Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            Player _target = (Player)target;

            SharedGUIOne(_target);
            SharedGUITwo(_target);

            SettingsManager settingsManager = AdvGame.GetReferences().settingsManager;

            if (settingsManager && (settingsManager.hotspotDetection == HotspotDetection.PlayerVicinity || settingsManager.playerSwitching == PlayerSwitching.Allow))
            {
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.LabelField("Player settings", EditorStyles.boldLabel);

                if (settingsManager.hotspotDetection == HotspotDetection.PlayerVicinity)
                {
                    _target.hotspotDetector = (DetectHotspots)EditorGUILayout.ObjectField("Hotspot detector child:", _target.hotspotDetector, typeof(DetectHotspots), true);
                }

                if (settingsManager.playerSwitching == PlayerSwitching.Allow)
                {
                    _target.associatedNPCPrefab = (NPC)EditorGUILayout.ObjectField("Associated NPC prefab:", _target.associatedNPCPrefab, typeof(NPC), false);
                }

                EditorGUILayout.EndVertical();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            MainCamera _target = (MainCamera)target;

            EditorGUILayout.BeginVertical("Button");
            _target.fadeTexture     = (Texture2D)EditorGUILayout.ObjectField("Fade texture:", _target.fadeTexture, typeof(Texture2D), false);
            _target.lookAtTransform = (Transform)EditorGUILayout.ObjectField("LookAt child:", _target.lookAtTransform, typeof(Transform), true);
            EditorGUILayout.EndVertical();

            if (Application.isPlaying)
            {
                EditorGUILayout.BeginVertical("Button");
                if (_target.attachedCamera)
                {
                    _target.attachedCamera = (_Camera)EditorGUILayout.ObjectField("Attached camera:", _target.attachedCamera, typeof(_Camera), true);
                }
                else
                {
                    EditorGUILayout.LabelField("Attached camera: None");
                }
                EditorGUILayout.EndVertical();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 3
0
        private void OnSceneGUI()
        {
            SortingMap _target = (SortingMap)target;

            for (int i = 0; i < _target.sortingAreas.Count; i++)
            {
                Vector3 newPosition = _target.GetAreaPosition(i);
                newPosition = Handles.PositionHandle(newPosition, Quaternion.identity);
                _target.sortingAreas [i].z = (newPosition - _target.transform.position).magnitude / _target.transform.forward.magnitude;

                Vector3 midPoint = _target.transform.position;
                if (i == 0)
                {
                    midPoint += _target.transform.forward * _target.sortingAreas [i].z / 2f;
                }
                else
                {
                    midPoint += _target.transform.forward * (_target.sortingAreas [i].z + _target.sortingAreas [i - 1].z) / 2f;
                }
                if (_target.mapType == SortingMapType.OrderInLayer)
                {
                    Handles.Label(midPoint, _target.sortingAreas [i].order.ToString());
                }
                else
                {
                    Handles.Label(midPoint, _target.sortingAreas [i].layer);
                }
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            Shapeable _target = (Shapeable)target;

            _target.shapeGroups = AllGroupsGUI(_target.shapeGroups);

            if (selectedGroup != null)
            {
                List <string> blendShapeNames = new List <string>();
                if (_target.GetComponent <SkinnedMeshRenderer>() && _target.GetComponent <SkinnedMeshRenderer>().sharedMesh)
                {
                    for (int i = 0; i < _target.GetComponent <SkinnedMeshRenderer>().sharedMesh.blendShapeCount; i++)
                    {
                        blendShapeNames.Add(_target.GetComponent <SkinnedMeshRenderer>().sharedMesh.GetBlendShapeName(i));
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("This component should be attached to a Skinned Mesh Renderer.", MessageType.Warning);
                }

                selectedGroup = GroupGUI(selectedGroup, blendShapeNames.ToArray());
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
        public override void OnInspectorGUI()
        {
            FootstepSounds _target = (FootstepSounds)target;

            EditorGUILayout.Space();
            _target.footstepSounds = ShowClipsGUI(_target.footstepSounds, "Walking sounds");
            EditorGUILayout.Space();
            _target.runSounds = ShowClipsGUI(_target.runSounds, "Running sounds (optional)");
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            _target.character = (Char)CustomGUILayout.ObjectField <Char> ("Character:", _target.character, true, "", "The Player or NPC that this component is for");
            if (_target.doGroundedCheck)
            {
                _target.doGroundedCheck = CustomGUILayout.ToggleLeft("Only play when grounded?", _target.doGroundedCheck, "", "If True, sounds will only play when the character is grounded");
            }
            _target.soundToPlayFrom = (Sound)CustomGUILayout.ObjectField <Sound> ("Sound to play from:", _target.soundToPlayFrom, true, "", "The Sound object to play from");

            _target.footstepPlayMethod = (FootstepSounds.FootstepPlayMethod)CustomGUILayout.EnumPopup("Play sounds:", _target.footstepPlayMethod, "", "How the sounds are played");
            if (_target.footstepPlayMethod == FootstepSounds.FootstepPlayMethod.Automatically)
            {
                _target.walkSeparationTime = CustomGUILayout.FloatField("Walking separation time (s):", _target.walkSeparationTime, "", "The separation time between sounds when walking");
                _target.runSeparationTime  = CustomGUILayout.FloatField("Running separation time (s):", _target.runSeparationTime, "", "The separation time between sounds when running");
            }
            else if (_target.footstepPlayMethod == FootstepSounds.FootstepPlayMethod.ViaAnimationEvents)
            {
                EditorGUILayout.HelpBox("A sound will be played whenever this component's PlayFootstep function is run. This component should be placed on the same GameObject as the Animator.", MessageType.Info);
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
        public override void OnInspectorGUI()
        {
            MainCamera _target = (MainCamera)target;

            EditorGUILayout.BeginVertical("Button");
            _target.fadeTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Fade texture:", _target.fadeTexture, false, "", "The texture to display fullscreen when fading");

                        #if ALLOW_VR
            if (PlayerSettings.virtualRealitySupported)
            {
                _target.restoreTransformOnLoadVR = CustomGUILayout.ToggleLeft("Restore transform when loading?", _target.restoreTransformOnLoadVR, "", "If True, the camera's position and rotation will be restored when loading (Hand for VR)");
            }
                        #endif

            EditorGUILayout.EndVertical();

            if (Application.isPlaying)
            {
                EditorGUILayout.BeginVertical("Button");
                if (_target.attachedCamera)
                {
                    _target.attachedCamera = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Attached camera:", _target.attachedCamera, true, "", "The current active camera, i.e. the one that the MainCamera is attaching itself to");
                }
                else
                {
                    EditorGUILayout.LabelField("Attached camera: None");
                }
                EditorGUILayout.EndVertical();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 7
0
        public override void OnInspectorGUI()
        {
            PlayerStart _target = (PlayerStart)target;

            if (KickStarter.sceneSettings != null && KickStarter.sceneSettings.defaultPlayerStart == _target)
            {
                EditorGUILayout.HelpBox("This PlayerStart is the scene's default, and will be used if a more appropriate one is not found.", MessageType.Info);
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Previous scene that activates", EditorStyles.boldLabel);
            _target.chooseSceneBy = (ChooseSceneBy)CustomGUILayout.EnumPopup("Choose scene by:", _target.chooseSceneBy, "", "The way in which the previous scene is identified by");
            if (_target.chooseSceneBy == ChooseSceneBy.Name)
            {
                _target.previousSceneName = CustomGUILayout.TextField("Previous scene:", _target.previousSceneName, "", "The name of the previous scene to check for");
            }
            else
            {
                _target.previousScene = CustomGUILayout.IntField("Previous scene:", _target.previousScene, "", "The build-index number of the previous scene to check for");
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Camera settings", EditorStyles.boldLabel);
            _target.cameraOnStart = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Camera on start:", _target.cameraOnStart, true, "", "The AC _Camera that should be made active when the Player starts the scene from this point");
            _target.fadeInOnStart = CustomGUILayout.Toggle("Fade in on start?", _target.fadeInOnStart, "", "If True, then the MainCamera will fade in when the Player starts the scene from this point");
            if (_target.fadeInOnStart)
            {
                _target.fadeSpeed = CustomGUILayout.FloatField("Fade speed:", _target.fadeSpeed, "", "The speed of the fade");
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 8
0
        public override void OnInspectorGUI()
        {
            _target = (Variables)target;

            ShowSettings();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showVariablesList = CustomGUILayout.ToggleHeader(showVariablesList, "Component variables");
            if (showVariablesList)
            {
                selectedVar = VariablesManager.ShowVarList(selectedVar, _target.vars, VariableLocation.Component, varFilter, _target.filter, typeFilter, !Application.isPlaying, _target);
            }
            EditorGUILayout.EndVertical();

            if (selectedVar != null)
            {
                EditorGUILayout.Space();
                EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                showProperties = CustomGUILayout.ToggleHeader(showProperties, "Variable '" + selectedVar.label + "' properties");
                if (showProperties)
                {
                    VariablesManager.ShowVarGUI(selectedVar, VariableLocation.Component, !Application.isPlaying, null, string.Empty, _target);
                }
                EditorGUILayout.EndVertical();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
        public override void OnInspectorGUI()
        {
            FootstepSounds _target = (FootstepSounds)target;

            EditorGUILayout.Space();
            _target.footstepSounds = ShowClipsGUI(_target.footstepSounds, "Walking sounds");
            EditorGUILayout.Space();
            _target.runSounds = ShowClipsGUI(_target.runSounds, "Running sounds (optional)");
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            _target.character       = (Char)EditorGUILayout.ObjectField("Character:", _target.character, typeof(Char), true);
            _target.doGroundedCheck = EditorGUILayout.ToggleLeft("Only play when grounded?", _target.doGroundedCheck);
            if (_target.doGroundedCheck && _target.character == null)
            {
                EditorGUILayout.HelpBox("A Character must be assigned for the 'grounded' check to work.", MessageType.Warning);
            }
            _target.soundToPlayFrom = (Sound)EditorGUILayout.ObjectField("Sound to play from:", _target.soundToPlayFrom, typeof(Sound), true);

            _target.footstepPlayMethod = (FootstepSounds.FootstepPlayMethod)EditorGUILayout.EnumPopup("Play sounds:", _target.footstepPlayMethod);
            if (_target.footstepPlayMethod == FootstepSounds.FootstepPlayMethod.Automatically)
            {
                _target.walkSeparationTime = EditorGUILayout.FloatField("Walking separation time (s):", _target.walkSeparationTime);
                _target.runSeparationTime  = EditorGUILayout.FloatField("Running separation time (s):", _target.runSeparationTime);
            }
            else if (_target.footstepPlayMethod == FootstepSounds.FootstepPlayMethod.ViaAnimationEvents)
            {
                EditorGUILayout.HelpBox("A sound will be played whenever this component's PlayFootstep function is run.", MessageType.Info);
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 10
0
        public override void OnInspectorGUI()
        {
            if (_target == null)
            {
                return;
            }

            if (Application.isPlaying)
            {
                EditorGUILayout.LabelField("Menu name:", _target.menuName);
                EditorGUILayout.LabelField("Element name:", _target.elementName);
                EditorGUILayout.LabelField("Slot number:", _target.slot.ToString());
                EditorGUILayout.LabelField("Is visible?", _target.IsVisible().ToString());

                if (GUILayout.Button("Interact"))
                {
                    _target.Interact();
                }
            }
            else
            {
                _target.menuName    = EditorGUILayout.TextField("Menu name:", _target.menuName);
                _target.elementName = EditorGUILayout.TextField("Element name:", _target.elementName);
                _target.slot        = EditorGUILayout.IntField("Slot number (optional):", _target.slot);
            }

            _target.setTextLabels = EditorGUILayout.Toggle("Set guiText / TextMesh labels?", _target.setTextLabels);

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 11
0
        public override void OnInspectorGUI()
        {
            Highlight _target = (Highlight)target;

            _target.highlightWhenSelected = CustomGUILayout.ToggleLeft("Enable when associated Hotspot is selected?", _target.highlightWhenSelected, "", "If True, then the Highlight effect will be enabled automatically when the Hotspot is selected");
            _target.brightenMaterials     = CustomGUILayout.ToggleLeft("Auto-brighten materials when enabled?", _target.brightenMaterials, "", "If True, then Materials associated with the GameObject's Renderer will be affected. Otherwise, their intended values will be calculated, but not applied, allowing for custom effects to be achieved");
            if (_target.brightenMaterials)
            {
                _target.affectChildren = CustomGUILayout.ToggleLeft("Also affect child Renderer components?", _target.affectChildren, "", "If True, then child Renderer GameObjects will be brightened as well");
            }
            _target.maxHighlight  = CustomGUILayout.Slider("Maximum highlight intensity:", _target.maxHighlight, 1f, 5f, "", "The maximum highlight intensity (1 = no effect)");
            _target.fadeTime      = CustomGUILayout.Slider("Transition time (s):", _target.fadeTime, 0f, 5f, "", "The fade time for the highlight transition effect");
            _target.flashHoldTime = CustomGUILayout.Slider("Flash hold time (s)", _target.flashHoldTime, 0f, 5f, "", "The length of time that a flash will hold for");

            _target.callEvents = CustomGUILayout.ToggleLeft("Call custom events?", _target.callEvents, "", "If True, then custom events can be called when highlighting the object");
            if (_target.callEvents)
            {
                this.serializedObject.Update();
                EditorGUILayout.PropertyField(this.serializedObject.FindProperty("onHighlightOn"), true);
                EditorGUILayout.PropertyField(this.serializedObject.FindProperty("onHighlightOff"), true);
                this.serializedObject.ApplyModifiedProperties();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 12
0
        public override void OnInspectorGUI()
        {
            if (_target == null)
            {
                return;
            }

            if (Application.isPlaying)
            {
                EditorGUILayout.LabelField("Menu name:", _target.menuName);
                EditorGUILayout.LabelField("Element name:", _target.elementName);
                EditorGUILayout.LabelField("Slot number:", _target.slot.ToString());
                EditorGUILayout.LabelField("Is visible?", _target.IsVisible().ToString());

                if (GUILayout.Button("Interact"))
                {
                    _target.Interact();
                }
            }
            else
            {
                _target.menuName    = CustomGUILayout.TextField("Menu name:", _target.menuName, "", "The name of the associated Menu");
                _target.elementName = CustomGUILayout.TextField("Element name:", _target.elementName, "", "The name of the associated MenuElement in the Menu above");
                _target.slot        = CustomGUILayout.IntField("Slot number (optional):", _target.slot, "", "The slot index of the associated MenuElement");
            }

            _target.setTextLabels = CustomGUILayout.Toggle("Set guiText / TextMesh labels?", _target.setTextLabels, "", "If True, then any GUIText or TextMesh components will have their text values overridden by that of the associated MenuElement");

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 13
0
        public override void OnInspectorGUI()
        {
            PlayerStart _target = (PlayerStart)target;

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Previous scene that activates", EditorStyles.boldLabel);
            _target.chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", _target.chooseSceneBy);
            if (_target.chooseSceneBy == ChooseSceneBy.Name)
            {
                _target.previousSceneName = EditorGUILayout.TextField("Previous scene:", _target.previousSceneName);
            }
            else
            {
                _target.previousScene = EditorGUILayout.IntField("Previous scene:", _target.previousScene);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Camera settings", EditorStyles.boldLabel);
            _target.cameraOnStart = (_Camera)EditorGUILayout.ObjectField("Camera on start:", _target.cameraOnStart, typeof(_Camera), true);
            _target.fadeInOnStart = EditorGUILayout.Toggle("Fade in on start?", _target.fadeInOnStart);
            if (_target.fadeInOnStart)
            {
                _target.fadeSpeed = EditorGUILayout.FloatField("Fade speed:", _target.fadeSpeed);
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 14
0
        public override void OnInspectorGUI()
        {
            FollowSortingMap _target = (FollowSortingMap)target;

            _target.followSortingMap = CustomGUILayout.Toggle("Follow default Sorting Map?", _target.followSortingMap, "", "If True, then the component will follow the default Sorting Map defined in the Scene Manager");
            if (!_target.followSortingMap)
            {
                _target.customSortingMap = (SortingMap)CustomGUILayout.ObjectField <SortingMap> ("Sorting Map to follow:", _target.customSortingMap, true, "", "The Sorting Map to follow");
            }

            if (_target.followSortingMap || _target.customSortingMap != null)
            {
                _target.offsetOriginal = CustomGUILayout.Toggle("Offset original Order?", _target.offsetOriginal, "", "If True, then the SpriteRenderer's sorting values will be increased by their original values when the game began");
                _target.affectChildren = CustomGUILayout.Toggle("Also affect children?", _target.affectChildren, "", "If True, then the sorting values of child SpriteRenderers will be affected as well");

                bool oldPreviewValue = _target.livePreview;
                _target.livePreview = CustomGUILayout.Toggle("Edit-mode preview?", _target.livePreview, "", "If True, then the script will update the SpriteRender's sorting values when the game is not running");
                if (oldPreviewValue && !_target.livePreview)
                {
                    // Just unchecked, so reset scale
                    if (!Application.isPlaying && _target.GetComponentInParent <Char>() != null && _target.GetComponentInParent <Char>().spriteChild != null)
                    {
                        _target.GetComponentInParent <Char>().transform.localScale = Vector3.one;
                    }
                }
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 15
0
        private void CopyScriptable()
        {
            if (Application.isPlaying)
            {
                return;
            }

            if (actions == null || actions.Count == 0 || source == ActionListSource.AssetFile)
            {
                return;
            }

            bool modified = false;

            for (int i = 0; i < actions.Count; i++)
            {
                if (actions[i] != null && actions[i].parentActionListInEditor != this)
                {
                    actions[i]      = Instantiate(actions[i]) as Action;
                    actions[i].name = actions[i].name.Replace("(Clone)", string.Empty);
                    actions[i].parentActionListInEditor = this;
                    modified = true;
                }
            }
            if (modified)
            {
                UnityVersionHandler.CustomSetDirty(this);
            }
        }
Ejemplo n.º 16
0
        public override void OnInspectorGUI()
        {
            RuntimeActionList _target = (RuntimeActionList)target;

            if (Application.isPlaying)
            {
                CustomGUILayout.BeginVertical();
                EditorGUILayout.ObjectField("Asset source:", _target.assetSource, typeof(ActionListAsset), false);

                if (_target.useParameters)
                {
                    CustomGUILayout.EndVertical();
                    CustomGUILayout.BeginVertical();
                    EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel);
                    ActionListEditor.ShowParametersGUI(_target, null, _target.parameters);
                }
                CustomGUILayout.EndVertical();
            }
            else
            {
                EditorGUILayout.HelpBox("This component should not be added manually - it is added automatically by AC at runtime.", MessageType.Warning);
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 17
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.BeginVertical("Button");

                        #if ALLOW_LEGACY_UI
            _target.backgroundMethod25D = (BackgroundImage.BackgroundMethod25D)CustomGUILayout.EnumPopup("Method:", _target.backgroundMethod25D, "", "How 2.5D backgrounds are renderered");
            if (_target.backgroundMethod25D == BackgroundImage.BackgroundMethod25D.GUITexture)
            {
                if (Object.FindObjectOfType <BackgroundImageUI>() != null)
                {
                    BackgroundImageUI.Instance.ClearTexture(null);
                }

                if (_target.GUITexture == null)
                {
                    EditorGUILayout.HelpBox("A GUITexture component must be attached to this object for the chosen method to work.", MessageType.Warning);
                }
            }
            else if (_target.backgroundMethod25D == BackgroundImage.BackgroundMethod25D.UnityUI)
            {
                        #endif
            _target.backgroundTexture = (Texture)CustomGUILayout.ObjectField <Texture> ("Background texture:", _target.backgroundTexture, false, "", "The texture to display full-screen");
                        #if ALLOW_LEGACY_UI
        }
                        #endif

                        #if UNITY_STANDALONE && (UNITY_5 || UNITY_2017_1_OR_NEWER || UNITY_PRO_LICENSE) && !UNITY_2018_2_OR_NEWER
            EditorGUILayout.LabelField("When playing a MovieTexture:");
            _target.loopMovie = CustomGUILayout.Toggle("Loop clip?", _target.loopMovie, "", "If True, then any MovieTexture set as the background will be looped");
            _target.restartMovieWhenTurnOn = CustomGUILayout.Toggle("Restart clip each time?", _target.restartMovieWhenTurnOn, "", "If True, then any MovieTexture set as the background will start from the beginning when the associated Camera is activated");
                        #endif

            EditorGUILayout.EndVertical();
            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 18
0
        /**
         * <summary>Upgrades the component to make use of the limitToCameras List, rather than the singular limitToCamera variable.</summary>
         */
        public void Upgrade()
        {
            if (limitToCameras == null)
            {
                limitToCameras = new List <_Camera>();
            }

            if (limitToCamera != null)
            {
                if (!limitToCameras.Contains(limitToCamera))
                {
                    limitToCameras.Add(limitToCamera);
                }
                limitToCamera = null;

                                #if UNITY_EDITOR
                if (Application.isPlaying)
                {
                    ACDebug.Log("LimitVisibility component on '" + gameObject.name + "' has been temporarily upgraded - please view its Inspector when the game ends and save the scene.");
                }
                else
                {
                    UnityVersionHandler.CustomSetDirty(this, true);
                    ACDebug.Log("Upgraded LimitVisibility on '" + gameObject.name + "', please save the scene.");
                }
                                #endif
            }
        }
Ejemplo n.º 19
0
 /**
  * Upgrades the Conversation from a previous version of Adventure Creator.
  */
 public void Upgrade()
 {
     // Set IDs as index + 1 (because default is 0 when not upgraded)
     if (options.Count > 0 && options[0].ID == 0)
     {
         for (int i = 0; i < options.Count; i++)
         {
             options[i].ID = i + 1;
         }
                         #if UNITY_EDITOR
         if (Application.isPlaying)
         {
             ACDebug.Log("Conversation '" + gameObject.name + "' has been temporarily upgraded - please view its Inspector when the game ends and save the scene.");
         }
         else
         {
             UnityVersionHandler.CustomSetDirty(this, true);
             if (!this.gameObject.activeInHierarchy)
             {
                 // Asset file
                 UnityEditor.AssetDatabase.SaveAssets();
             }
             ACDebug.Log("Upgraded Conversation '" + gameObject.name + "', please save the scene.");
         }
                         #endif
     }
 }
Ejemplo n.º 20
0
        public void OnSceneGUI()
        {
            DragTrack_Straight _target = (DragTrack_Straight)target;

            Handles.color = _target.handleColour;
            Vector3 maxPosition = _target.GetGizmoPosition(1f);

            maxPosition = Handles.PositionHandle(maxPosition, Quaternion.identity);
            Handles.DrawSolidDisc(maxPosition, -_target.transform.up, _target.discSize);
            if (EditorGUI.EndChangeCheck())
            {
                _target.maxDistance = Vector3.Dot(maxPosition - _target.transform.position, _target.transform.up);
            }

            Handles.color = new Color(_target.handleColour.r / 2f, _target.handleColour.g / 2f, _target.handleColour.b / 2f, _target.handleColour.a);
            Handles.DrawSolidDisc(_target.GetGizmoPosition(0f), _target.transform.up, _target.discSize);

            Handles.color = _target.handleColour;
            Handles.DrawLine(_target.GetGizmoPosition(0f), maxPosition);

            UnityVersionHandler.CustomSetDirty(_target);

            foreach (TrackSnapData trackSnapData in _target.allTrackSnapData)
            {
                DrawTrackRegions(trackSnapData, _target);
            }
        }
Ejemplo n.º 21
0
        private void OnSceneGUI()
        {
            SortingMap _target = (SortingMap)target;

            GUIStyle style = new GUIStyle();

            style.normal.textColor  = Color.white;
            style.normal.background = Resource.GreyTexture;

            for (int i = 0; i < _target.sortingAreas.Count; i++)
            {
                Vector3 newPosition = _target.GetAreaPosition(i);
                newPosition = Handles.PositionHandle(newPosition, Quaternion.identity);
                _target.sortingAreas [i].z = (newPosition - _target.transform.position).magnitude / _target.transform.forward.magnitude;

                Vector3 midPoint = _target.transform.position;
                if (i == 0)
                {
                    midPoint += _target.transform.forward * _target.sortingAreas [i].z / 2f;
                }
                else
                {
                    midPoint += _target.transform.forward * (_target.sortingAreas [i].z + _target.sortingAreas [i - 1].z) / 2f;
                }

                string label = (_target.mapType == SortingMapType.OrderInLayer) ? _target.sortingAreas [i].order.ToString() : _target.sortingAreas [i].layer;

                Handles.Label(midPoint, label, style);
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 22
0
        public override void OnInspectorGUI()
        {
            Highlight _target = (Highlight)target;

            _target.highlightWhenSelected = EditorGUILayout.ToggleLeft("Enable when associated Hotspot is selected?", _target.highlightWhenSelected);
            _target.brightenMaterials     = EditorGUILayout.ToggleLeft("Auto-brighten materials when enabled?", _target.brightenMaterials);
            if (_target.affectChildren)
            {
                _target.affectChildren = EditorGUILayout.ToggleLeft("Also affect child Renderer components?", _target.affectChildren);
            }
            _target.maxHighlight  = EditorGUILayout.Slider("Maximum highlight intensity:", _target.maxHighlight, 1f, 5f);
            _target.fadeTime      = EditorGUILayout.Slider("Transition time (s):", _target.fadeTime, 0f, 5f);
            _target.flashHoldTime = EditorGUILayout.Slider("Flash hold time (s)", _target.flashHoldTime, 0f, 5f);

            _target.callEvents = EditorGUILayout.ToggleLeft("Call custom events?", _target.callEvents);
            if (_target.callEvents)
            {
                this.serializedObject.Update();
                EditorGUILayout.PropertyField(this.serializedObject.FindProperty("onHighlightOn"), true);
                EditorGUILayout.PropertyField(this.serializedObject.FindProperty("onHighlightOff"), true);
                this.serializedObject.ApplyModifiedProperties();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 23
0
        public override void OnInspectorGUI()
        {
            PlayerStart _target = (PlayerStart)target;

            if (KickStarter.sceneSettings != null && KickStarter.sceneSettings.defaultPlayerStart == _target)
            {
                EditorGUILayout.HelpBox("This PlayerStart is the scene's default, and will be used if a more appropriate one is not found.", MessageType.Info);
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Previous scene that activates", EditorStyles.boldLabel);
            _target.chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", _target.chooseSceneBy);
            if (_target.chooseSceneBy == ChooseSceneBy.Name)
            {
                _target.previousSceneName = EditorGUILayout.TextField("Previous scene:", _target.previousSceneName);
            }
            else
            {
                _target.previousScene = EditorGUILayout.IntField("Previous scene:", _target.previousScene);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Camera settings", EditorStyles.boldLabel);
            _target.cameraOnStart = (_Camera)EditorGUILayout.ObjectField("Camera on start:", _target.cameraOnStart, typeof(_Camera), true);
            _target.fadeInOnStart = EditorGUILayout.Toggle("Fade in on start?", _target.fadeInOnStart);
            if (_target.fadeInOnStart)
            {
                _target.fadeSpeed = EditorGUILayout.FloatField("Fade speed:", _target.fadeSpeed);
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 24
0
        public override void OnInspectorGUI()
        {
            MainCamera _target = (MainCamera)target;

            EditorGUILayout.BeginVertical("Button");
            _target.fadeTexture     = (Texture2D)EditorGUILayout.ObjectField("Fade texture:", _target.fadeTexture, typeof(Texture2D), false);
            _target.lookAtTransform = (Transform)EditorGUILayout.ObjectField("LookAt child:", _target.lookAtTransform, typeof(Transform), true);

                        #if ALLOW_VR
            if (PlayerSettings.virtualRealitySupported)
            {
                _target.restoreTransformOnLoadVR = EditorGUILayout.ToggleLeft("Restore transform when loading?", _target.restoreTransformOnLoadVR);
            }
                        #endif

            EditorGUILayout.EndVertical();

            if (Application.isPlaying)
            {
                EditorGUILayout.BeginVertical("Button");
                if (_target.attachedCamera)
                {
                    _target.attachedCamera = (_Camera)EditorGUILayout.ObjectField("Attached camera:", _target.attachedCamera, typeof(_Camera), true);
                }
                else
                {
                    EditorGUILayout.LabelField("Attached camera: None");
                }
                EditorGUILayout.EndVertical();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 25
0
        private void OnCreateVariable()
        {
            variableName = variableName.Trim();

            if (string.IsNullOrEmpty(variableName))
            {
                EditorUtility.DisplayDialog("Unable to create Variable", "Please specify a valid Variable name.", "Close");
                return;
            }

            if (location == VariableLocation.Global && AdvGame.GetReferences() != null && AdvGame.GetReferences().variablesManager != null)
            {
                Undo.RecordObject(AdvGame.GetReferences().variablesManager, "Create variable");
                CreateNewVariable(AdvGame.GetReferences().variablesManager.vars);

                UnityVersionHandler.CustomSetDirty(AdvGame.GetReferences().variablesManager);
            }
            else if (location == VariableLocation.Local && KickStarter.localVariables != null)
            {
                Undo.RecordObject(KickStarter.localVariables, "Create variable");
                CreateNewVariable(KickStarter.localVariables.localVars);

                UnityVersionHandler.CustomSetDirty(KickStarter.localVariables);
            }

            Close();
        }
Ejemplo n.º 26
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.BeginVertical("Button");

                        #if ALLOW_LEGACY_UI
            _target.backgroundMethod25D = (BackgroundImage.BackgroundMethod25D)EditorGUILayout.EnumPopup("Method:", _target.backgroundMethod25D);
            if (_target.backgroundMethod25D == BackgroundImage.BackgroundMethod25D.GUITexture)
            {
                if (Object.FindObjectOfType <BackgroundImageUI>() != null)
                {
                    BackgroundImageUI.Instance.ClearTexture(null);
                }

                if (_target.GUITexture == null)
                {
                    EditorGUILayout.HelpBox("A GUITexture component must be attached to this object for the chosen method to work.", MessageType.Warning);
                }
            }
            else if (_target.backgroundMethod25D == BackgroundImage.BackgroundMethod25D.UnityUI)
            {
                        #endif
            _target.backgroundTexture = (Texture)EditorGUILayout.ObjectField("Background texture:", _target.backgroundTexture, typeof(Texture), false);
                        #if ALLOW_LEGACY_UI
        }
                        #endif

                        #if UNITY_STANDALONE && (UNITY_5 || UNITY_2017_1_OR_NEWER || UNITY_PRO_LICENSE) && !UNITY_2018_2_OR_NEWER
            EditorGUILayout.LabelField("When playing a MovieTexture:");
            _target.loopMovie = EditorGUILayout.Toggle("Loop clip?", _target.loopMovie);
            _target.restartMovieWhenTurnOn = EditorGUILayout.Toggle("Restart clip each time?", _target.restartMovieWhenTurnOn);
                        #endif

            EditorGUILayout.EndVertical();
            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 27
0
        public override void OnInspectorGUI()
        {
            FollowSortingMap _target = (FollowSortingMap)target;

            _target.followSortingMap = EditorGUILayout.Toggle("Follow default Sorting Map?", _target.followSortingMap);
            if (!_target.followSortingMap)
            {
                _target.customSortingMap = (SortingMap)EditorGUILayout.ObjectField("Sorting Map to follow:", _target.customSortingMap, typeof(SortingMap), true);
            }

            if (_target.followSortingMap || _target.customSortingMap != null)
            {
                _target.offsetOriginal = EditorGUILayout.Toggle("Offset original Order?", _target.offsetOriginal);
                _target.affectChildren = EditorGUILayout.Toggle("Also affect children?", _target.affectChildren);

                bool oldPreviewValue = _target.livePreview;
                _target.livePreview = EditorGUILayout.Toggle("Edit-mode preview?", _target.livePreview);
                if (oldPreviewValue && !_target.livePreview)
                {
                    // Just unchecked, so reset scale
                    if (!Application.isPlaying && _target.GetComponentInParent <Char>() != null && _target.GetComponentInParent <Char>().spriteChild != null)
                    {
                        _target.GetComponentInParent <Char>().transform.localScale = Vector3.one;
                    }
                }
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 28
0
        public override void OnInspectorGUI()
        {
            FirstPersonCamera _target = (FirstPersonCamera)target;

            EditorGUILayout.BeginVertical("Button");
            _target.headBob = EditorGUILayout.Toggle("Bob head when moving?", _target.headBob);
            if (_target.headBob)
            {
                _target.headBobMethod = (FirstPersonHeadBobMethod)EditorGUILayout.EnumPopup("Head-bob method:", _target.headBobMethod);
                if (_target.headBobMethod == FirstPersonHeadBobMethod.BuiltIn)
                {
                    _target.builtInSpeedFactor = EditorGUILayout.FloatField("Speed factor:", _target.builtInSpeedFactor);
                    _target.bobbingAmount      = EditorGUILayout.FloatField("Height change factor:", _target.bobbingAmount);
                }
                else if (_target.headBobMethod == FirstPersonHeadBobMethod.CustomAnimation)
                {
                    _target.headBobSpeedParameter     = EditorGUILayout.TextField("Forward speed float parameter:", _target.headBobSpeedParameter);
                    _target.headBobSpeedSideParameter = EditorGUILayout.TextField("Sideways speed float parameter:", _target.headBobSpeedSideParameter);
                    if (_target.GetComponent <Animator>() == null)
                    {
                        EditorGUILayout.HelpBox("This GameObject must have an Animator component attached.", MessageType.Warning);
                    }
                }
                else if (_target.headBobMethod == FirstPersonHeadBobMethod.CustomScript)
                {
                    EditorGUILayout.HelpBox("The component's public method 'GetHeadBobSpeed' will return the desired head-bobbing speed.", MessageType.Info);
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            _target.allowMouseWheelZooming = EditorGUILayout.Toggle("Allow mouse-wheel zooming?", _target.allowMouseWheelZooming);
            if (_target.allowMouseWheelZooming)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Min FOV:", labelWidth);
                _target.minimumZoom = EditorGUILayout.FloatField(_target.minimumZoom, intWidth);
                EditorGUILayout.LabelField("Max FOV:", labelWidth);
                _target.maximumZoom = EditorGUILayout.FloatField(_target.maximumZoom, intWidth);
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Constrain pitch-rotation (degrees)");
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Min:", labelWidth);
            _target.minY = EditorGUILayout.FloatField(_target.minY, intWidth);
            EditorGUILayout.LabelField("Max:", labelWidth);
            _target.maxY = EditorGUILayout.FloatField(_target.maxY, intWidth);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            _target.sensitivity = EditorGUILayout.Vector2Field("Freelook sensitivity:", _target.sensitivity);
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Ejemplo n.º 29
0
        public override void OnInspectorGUI()
        {
            ActionList _target = (ActionList)target;

            DrawSharedElements(_target);

            UnityVersionHandler.CustomSetDirty(_target);
        }
        public override void OnInspectorGUI()
        {
            _target = (SetInteractionParameters)target;

            _target.ShowGUI();

            UnityVersionHandler.CustomSetDirty(_target);
        }