public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.HelpBox("If this script appears to update one frame late, make sure you put it last in: Edit -> Project Settings -> Script Execution Order.", MessageType.Info);

        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Follow");
        {
            Target.FollowTarget = SGT_EditorGUI.ObjectField("Target", "The game object this game object will follow.", Target.FollowTarget);

            SGT_EditorGUI.MarkNextFieldAsBold(Target.FollowPosition == true);
            Target.FollowPosition = SGT_EditorGUI.BoolField("Position", "Match the target game object's position.", Target.FollowPosition);

            SGT_EditorGUI.BeginIndent(Target.FollowPosition == true);
            {
                Target.FollowPositionScale = SGT_EditorGUI.FloatField("Scale", null, Target.FollowPositionScale);
            }
            SGT_EditorGUI.EndIndent();

            Target.FollowRotation = SGT_EditorGUI.BoolField("Rotation", "Match the target game object's rotation.", Target.FollowRotation);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        Target.Seed = SGT_EditorGUI.SeedField("Seed", null, Target.Seed); SetAll("Seed");

        SGT_EditorGUI.Separator();

        Target.Rotation = SGT_EditorGUI.BeginToggleGroup("Rotation", null, Target.Rotation); SetAll("Rotation");
        {
            Target.RotationPeriod      = SGT_EditorGUI.FloatField("Period", null, Target.RotationPeriod); SetAll("RotationPeriod");
            Target.RotationChangeDelay = SGT_EditorGUI.FloatField("Change Delay", null, Target.RotationChangeDelay); SetAll("RotationChangeDelay");
            Target.RotationDampening   = SGT_EditorGUI.FloatField("Dampening", null, Target.RotationDampening); SetAll("RotationDampening");
        }
        SGT_EditorGUI.EndToggleGroup();

        SGT_EditorGUI.Separator();

        Target.Scale = SGT_EditorGUI.BeginToggleGroup("Scale", null, Target.Scale); SetAll("Scale");
        {
            Target.ScaleMin         = SGT_EditorGUI.FloatField("Min", null, Target.ScaleMin); SetAll("ScaleMin");
            Target.ScaleMax         = SGT_EditorGUI.FloatField("Max", null, Target.ScaleMax); SetAll("ScaleMax");
            Target.ScaleChangeDelay = SGT_EditorGUI.FloatField("Change Delay", null, Target.ScaleChangeDelay); SetAll("ScaleChangeDelay");
            Target.ScaleDampening   = SGT_EditorGUI.FloatField("Dampening", null, Target.ScaleDampening); SetAll("ScaleDampening");
        }
        SGT_EditorGUI.EndToggleGroup();

        SGT_EditorGUI.Separator();
    }
Example #3
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.MarkNextFieldAsBold();
        Target.Rotation = SGT_EditorGUI.QuaternionField("Rotation", "The current orbit rotation.", Target.Rotation);

        SGT_EditorGUI.BeginIndent();
        {
            Target.RotationSpeed     = SGT_EditorGUI.FloatField("Speed", "The speed at which the camera can rotate.", Target.RotationSpeed);
            Target.RotationDampening = SGT_EditorGUI.FloatField("Dampening", "How sharp the rotation is. A higher value means the rotation will reach its destination quickly.", Target.RotationDampening);
            Target.RotationRoll      = SGT_EditorGUI.BoolField("Roll", "Allow the orbit to be rotated when right click is held and dragged?", Target.RotationRoll);
        }
        SGT_EditorGUI.EndIndent();

        SGT_EditorGUI.Separator();

        SGT_EditorGUI.MarkNextFieldAsBold();
        Target.Distance = SGT_EditorGUI.FloatField("Distance", "The current orbit distance.", Target.Distance);

        SGT_EditorGUI.BeginIndent();
        {
            Target.DistanceMin       = SGT_EditorGUI.FloatField("Min", "The minimum orbit distance.", Target.DistanceMin);
            Target.DistanceMax       = SGT_EditorGUI.FloatField("Max", "The maximum orbit distance.", Target.DistanceMax);
            Target.DistanceSpeed     = SGT_EditorGUI.FloatField("Speed", "How fast the camera's distance can change when zooming.", Target.DistanceSpeed);
            Target.DistanceDampening = SGT_EditorGUI.FloatField("Dampening", "How sharp the distance change is is. A higher value means the rotation will reach its destination quickly.", Target.DistanceDampening);
        }
        SGT_EditorGUI.EndIndent();

        SGT_EditorGUI.Separator();
    }
Example #4
0
    public override void OnInspectorGUI()
    {
        var curEvent = Event.current;
        var snapshot = (curEvent.type != EventType.Repaint && curEvent.type != EventType.Layout) || SGT_AuxWindowHelper.instance != null;

        if (snapshot == true)
        {
            var undoTargets = new ObjectList();

            Target.BuildUndoTargets(undoTargets);

            Undo.RecordObjects(undoTargets.ToArray(), "Change to " + Target.name);
        }

        SGT_EditorGUI.ResetAll();

        OnInspector();

        if (SGT_EditorGUI.InspectorModified == true)
        {
            SGT_EditorGUI.InspectorModified = false;

            if (snapshot == true)
            {
                Undo.RecordObject(this, name);

                EditorUtility.SetDirty(target);
            }

            Repaint();
        }
    }
Example #5
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Star");
        {
            Target.StarObserver = SGT_EditorGUI.ObjectField("Observer", "The camera rendering this.", Target.StarObserver, true);
            Target.StarLutSize  = (SGT_SquareSize)SGT_EditorGUI.EnumField("LUT Size", "The texture look up table resolution. Use a higher value for smoother results, at the cost of GPU memory and texture sampling speed.", Target.StarLutSize);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Surface");
        {
            Target.SurfaceRadius        = SGT_EditorGUI.FloatField("Radius", "The star's equatorial surface radius.", Target.SurfaceRadius);
            Target.SurfaceOblateness    = SGT_EditorGUI.FloatField("Oblateness", "This specifies how oblate/flat/round the star is. A higher value means the polar radius will be lower than the equatorial radius. Large stars that spin are often quite oblate.", Target.SurfaceOblateness, 0.0f, 1.0f);
            Target.SurfaceConfiguration = (SGT_SurfaceConfiguration)SGT_EditorGUI.EnumField("Configuration", "Allows you to swap between using a sphere mesh with a cylindrical texture and using a cube mesh with a cube map.", Target.SurfaceConfiguration);
            Target.SurfaceRenderQueue   = SGT_EditorGUI.IntField("Render Queue", "The render queue used by the surface mesh.", Target.SurfaceRenderQueue);
            Target.SurfaceMesh          = SGT_EditorGUI.SurfaceMultiMeshField("Mesh", "This should be a sphere with a radius of 1.", Target.SurfaceMesh, true);
            Target.SurfaceTexture       = SGT_EditorGUI.Field("Texture", "This is the texture used by the star's surface.", Target.SurfaceTexture, true);

            SGT_EditorGUI.MarkNextFieldAsBold(Target.SurfaceCollider == true);
            Target.SurfaceCollider = SGT_EditorGUI.BoolField("Create Collider", "Create a MeshCollider from the surface mesh? Note: Don't use this in combination with the Surface Tessellator.", Target.SurfaceCollider);

            SGT_EditorGUI.BeginIndent(Target.SurfaceCollider == true);
            {
                Target.SurfaceColliderMaterial = SGT_EditorGUI.ObjectField("Collider Material", null, Target.SurfaceColliderMaterial);
            }
            SGT_EditorGUI.EndIndent();
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Atmosphere");
        {
            Target.AtmosphereMesh          = SGT_EditorGUI.ObjectField("Mesh", "This should be an inside-out sphere with a radius of 1.", Target.AtmosphereMesh, true);
            Target.AtmosphereRenderQueue   = SGT_EditorGUI.IntField("Render Queue", "The render queue used by the atmosphere and cloud meshes.", Target.AtmosphereRenderQueue);
            Target.AtmosphereHeight        = SGT_EditorGUI.FloatField("Height", "Distance between the surface of the star and the top of the atmosphere.", Target.AtmosphereHeight);
            Target.AtmosphereDensityColour = SGT_EditorGUI.Field("Density Colour", "The colour of the atmosphere based on the optical thickness. Left = Star's centre. Centre = Horizon. Right = Sky's zenith.", Target.AtmosphereDensityColour);
            Target.AtmosphereSkyAltitude   = SGT_EditorGUI.FloatField("Sky Altitude", "The altitude at which atmospheric density reaches maximum. This value is used to blend between the Atmosphere and Sky falloff values. A value of 0.25 means the observer must be 3/4 the way through the atmosphere for the atmosphere's falloff to reach the Sky falloff value.", Target.AtmosphereSkyAltitude, 0.0f, 1.0f);
            Target.AtmosphereFog           = SGT_EditorGUI.FloatField("Fog", "Specifies how much fog is present in the atmosphere.", Target.AtmosphereFog, 0.0f, 1.0f);

            SGT_EditorGUI.Separator();

            SGT_EditorGUI.BeginGroup("Falloff");
            {
                Target.AtmosphereFalloffSurface  = SGT_EditorGUI.FloatField("Surface", "The atmospheric falloff on the star's surface.", Target.AtmosphereFalloffSurface, 0.0f, 5.0f);
                Target.AtmosphereFalloffOutside  = SGT_EditorGUI.FloatField("Outside", "The sky's atmospheric falloff when viewed from space.", Target.AtmosphereFalloffOutside, 0.0f, 5.0f);
                Target.AtmosphereFalloffInside   = SGT_EditorGUI.FloatField("Inside", "The sky's atmospheric falloff when viewed from inside the atmosphere.", Target.AtmosphereFalloffInside, 0.0f, 5.0f);
                Target.AtmosphereFalloffPerPixel = SGT_EditorGUI.BoolField("Per Pixel", "Per-pixel optical depth checks.", Target.AtmosphereFalloffPerPixel);
            }
            SGT_EditorGUI.EndGroup();
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        Target.ThrusterController = SGT_EditorGUI.ObjectField("ThrusterController", null, Target.ThrusterController, true); SetAll("ThrusterController");

        SGT_EditorGUI.Separator();
    }
Example #7
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        Target.InitialVelocity = SGT_EditorGUI.Vector3Field("Initial Velocity", "Initial velocity of rigid body.", Target.InitialVelocity); SetAll("InitialVelocity");

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        Target.Font = SGT_EditorGUI.ObjectField("Font", "The font used by the FPS counter.", Target.Font, false);

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        Target.Font    = SGT_EditorGUI.ObjectField("Font", "The font used when displaying camera messages.", Target.Font, false);
        Target.Message = SGT_EditorGUI.StringField("Message", "The text that will be displayed as the camera message.", Target.Message);

        SGT_EditorGUI.Separator();
    }
Example #10
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        Target.IgnoreSceneZero = SGT_EditorGUI.BoolField("Ignore Scene Zero", "Skip past scene 0?", Target.IgnoreSceneZero);
        Target.AutoSwitch      = SGT_EditorGUI.BoolField("Auto Switch", "Automatically go to scene 1?", Target.AutoSwitch);

        SGT_EditorGUI.Separator();
    }
Example #11
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Nebula");
        {
            Target.NebulaTexture     = SGT_EditorGUI.ObjectField("Texture", "A picture of your nebula/galaxy.", Target.NebulaTexture, true);
            Target.NebulaTechnique   = (SGT_Nebula.Technique)SGT_EditorGUI.EnumField("Technique", "The blending mode used by the nebula particle shader.", Target.NebulaTechnique, true);
            Target.NebulaRenderQueue = SGT_EditorGUI.IntField("Render Queue", "The render queue used by the nebula particle material.", Target.NebulaRenderQueue);
            Target.NebulaSeed        = SGT_EditorGUI.SeedField("Seed", "The random seed used when generating the nebula particles.", Target.NebulaSeed);
            Target.NebulaSize        = SGT_EditorGUI.FloatField("Size", "The size of the nebula.", Target.NebulaSize);
            Target.NebulaResolution  = SGT_EditorGUI.IntField("Resolution", "Sets how detailed the final nebula will be, relative to the nebula texture.", Target.NebulaResolution);
            Target.NebulaCamera      = SGT_EditorGUI.ObjectField("Camera", "The main camera that's currently rendering this nebula.", Target.NebulaCamera, true);
            Target.NebulaMirror      = SGT_EditorGUI.BoolField("Mirror", "Allows you to mirror the nebula particles, so its symmetrical.", Target.NebulaMirror);
            Target.NebulaAutoRegen   = SGT_EditorGUI.BoolField("Auto Regen", "Automatically regenerate the nebula particle mesh when making changes?", Target.NebulaAutoRegen);

            if (Target.NebulaAutoRegen == false)
            {
                SGT_EditorGUI.BeginFrozen(Target.NebulaModified == true);
                {
                    if (SGT_EditorGUI.Button("Regenerate") == true)
                    {
                        Target.Regenerate();
                    }
                }
                SGT_EditorGUI.EndFrozen();
            }
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Height");
        {
            Target.HeightSource = (SGT_Nebula.TextureHeightSource)SGT_EditorGUI.EnumField("Source", "Allows you to choose which channel of the nebula texture will be used as the heightmap source.", Target.HeightSource);
            Target.HeightScale  = SGT_EditorGUI.FloatField("Scale", "Allows you to choose how steep/bumpy the final nebula will be.", Target.HeightScale);
            Target.HeightOffset = SGT_EditorGUI.FloatField("Offset", "Allows you to shift the nebula vertically, this is usually used in combination with the Nebula -> Mirror option.", Target.HeightOffset, -1.0f, 1.0f);
            Target.HeightInvert = SGT_EditorGUI.BoolField("Invert", "Invert the height values?", Target.HeightInvert);
            Target.HeightNoise  = SGT_EditorGUI.FloatField("Noise", "Allows you to add noise to the hightmap sample points.", Target.HeightNoise, 0.0f, 0.1f);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Particle");
        {
            Target.ParticleTexture        = SGT_EditorGUI.ObjectField("Texture", "The texture applied to the nebula particles.", Target.ParticleTexture, true);
            Target.ParticleScale          = SGT_EditorGUI.FloatField("Size", "The size of the nebula particles relative to the size of the nebula.", Target.ParticleScale);
            Target.ParticleSideColour     = SGT_EditorGUI.ColourField("Side Colour", "The colour of the dust particles when you're looking at the side of the nebula.", Target.ParticleSideColour);
            Target.ParticleTopColour      = SGT_EditorGUI.ColourField("Top Colour", "The colour of the dust particles when you're looking at the top of the nebula.", Target.ParticleTopColour);
            Target.ParticleJitter         = SGT_EditorGUI.FloatField("Jitter", "Allows you to add noise to the nebula particle positions.", Target.ParticleJitter, 0.0f, 0.1f);
            Target.ParticleFadeInDistance = SGT_EditorGUI.FloatField("Fade In Distance", "Sets how near the nebula particles can get before they fade away.", Target.ParticleFadeInDistance);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        Target.ThrusterController = SGT_EditorGUI.ObjectField("ThrusterController", null, Target.ThrusterController, true); SetAll("ThrusterController");
        Target.Axis = (SGT_2DSpaceshipController.RotationAxis)SGT_EditorGUI.EnumField("Axis", null, Target.Axis); SetAll("Axis");

        SGT_EditorGUI.Separator();
    }
Example #13
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        Target.MinScale  = SGT_EditorGUI.FloatField("Min Scale", "The minimum X/Y/Z scale of this debris.", Target.MinScale); SetAll("MinScale");
        Target.MaxScale  = SGT_EditorGUI.FloatField("Max Scale", "The maximum X/Y/Z scale of this debris.", Target.MaxScale); SetAll("MaxScale");
        Target.MaxSpeed  = SGT_EditorGUI.FloatField("Max Speed", "The maximum X/Y/Z velocity this debris has at spawn.", Target.MaxSpeed); SetAll("MaxSpeed");
        Target.MaxSpin   = SGT_EditorGUI.FloatField("Max Spin", "The maximum angular velocity this debris has at spawn.", Target.MaxSpin); SetAll("MaxSpin");
        Target.MassScale = SGT_EditorGUI.FloatField("Mass Scale", "The mass of this debris, relative to its volume.", Target.MassScale); SetAll("MassScale");

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Gravity Receiver");
        {
            Target.Type = (SGT_GravityReceiver.GravityType)SGT_EditorGUI.EnumField("Type", "The amount of gravity sources that can effect this.", Target.Type); SetAll("Type");
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Probe");
        {
            Target.ProbeRenderQueue = SGT_EditorGUI.IntField("Render Queue", "The render queue used by the probe material.", Target.ProbeRenderQueue);
            Target.ProbeRecursive   = SGT_EditorGUI.BoolField("Recursive", "Setting this to true means every renderer under this component will be affected.", Target.ProbeRecursive);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Drag");
        {
            Target.DragObject   = SGT_EditorGUI.ObjectField("Object", "The object that will be dragged based on the camera's change in angle.", Target.DragObject, true);
            Target.DragRequires = (SGT_CameraDrag.DragKey)SGT_EditorGUI.EnumField("Requires", "Which mouse button must be held down for dragging?", Target.DragRequires);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Collider");
        {
            Target.PhysicsMaterial = SGT_EditorGUI.ObjectField("Physics Material", null, Target.PhysicsMaterial);
            Target.HighestLOD      = SGT_EditorGUI.IntField("Highest LOD", "The highest patch level from the SurfaceTessellator that will be used. Note: Higher values will result in lower performance.", Target.HighestLOD);
            Target.VerticesPerMesh = SGT_EditorGUI.IntField("Vertices Per Mesh", "The maximum amount of verices that will be copied into each MeshCollider.", Target.VerticesPerMesh);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
Example #18
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Shoot");
        {
            Target.ShootObject   = SGT_EditorGUI.ObjectField("Object", "The game object the camera will shoot.", Target.ShootObject);
            Target.ShootSpeed    = SGT_EditorGUI.FloatField("Speed", "Initial speed of the shot object.", Target.ShootSpeed);
            Target.ShootRequires = (SGT_CameraShoot.ShootKey)SGT_EditorGUI.EnumField("Requires", "The mouse button required to shoot an object.", Target.ShootRequires);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Gravity Source");
        {
            Target.GravitySourceType   = (SGT_GravitySource.GravityType)SGT_EditorGUI.EnumField("Type", "The gravitational strength falloff model.", Target.GravitySourceType); SetAll("GravitySourceType");
            Target.GravitySourceForce  = SGT_EditorGUI.FloatField("Force", "The amount of force applied to objects caught in the gravity well.", Target.GravitySourceForce); SetAll("GravitySourceForce");
            Target.GravitySourceRadius = SGT_EditorGUI.FloatField("Radius", "The surface radius of the gravity source.", Target.GravitySourceRadius); SetAll("GravitySourceRadius");
            Target.GravitySourceHeight = SGT_EditorGUI.FloatField("Height", "The height the gravity well extends above the surface radius.", Target.GravitySourceHeight); SetAll("GravitySourceHeight");
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
Example #20
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Skysphere");
        {
            Target.SkysphereMesh        = SGT_EditorGUI.ObjectField("Mesh", "This should be an inside-out sphere with a radius of 1.", Target.SkysphereMesh, true);
            Target.SkysphereRenderQueue = SGT_EditorGUI.IntField("Render Queue", "The render queue used by the skysphere mesh.", Target.SkysphereRenderQueue);
            Target.SkysphereTexture     = SGT_EditorGUI.ObjectField("Texture", "The skysphere texture.", Target.SkysphereTexture, true);
            Target.SkysphereObserver    = SGT_EditorGUI.ObjectField("Observer", "The camera rendering this.", Target.SkysphereObserver, true);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
Example #21
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Displacement");
        {
            Target.DisplacementConfiguration = (SGT_SurfaceConfiguration)SGT_EditorGUI.EnumField("Configuration", "Allows you to swap between using a sphere mesh with a cylindrical texture and using a cube mesh with a cube map.", Target.DisplacementConfiguration);
            Target.DisplacementTexture       = SGT_EditorGUI.Field("Texture", "This should be a grayscale texture where black is Scale Min and white is Scale Max.", Target.DisplacementTexture, true);
            Target.DisplacementScaleMin      = SGT_EditorGUI.FloatField("Scale Min", "The final mesh scale if the displacement texture was purely black.", Target.DisplacementScaleMin);
            Target.DisplacementScaleMax      = SGT_EditorGUI.FloatField("Scale Max", "The final mesh scale if the displacement texture was purely white.", Target.DisplacementScaleMax);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Patch");
        {
            Target.PatchResolution = SGT_EditorGUI.IntField("Resolution", "The width and height of each terrain patch.", Target.PatchResolution, 2, 8);
            Target.PatchMaxLevels  = SGT_EditorGUI.IntField("Max Levels", "The amount of times a terrain patch can be subdivided.", Target.PatchMaxLevels, 1, 15);

            SGT_EditorGUI.Separator();

            SGT_EditorGUI.BeginGroup("LOD Distances");
            {
                for (var i = 0; i < Target.LevelDistanceCount; i++)
                {
                    Target.SetPatchLodDistance(i, SGT_EditorGUI.FloatField("Level " + i, "If the camera's distance to a level " + i + " terrain patch is less than this value, it will be split into four smaller patches, as long as it's less than PatchMaxLevels.", Target.GetPatchLodDistance(i)));
                }
            }
            SGT_EditorGUI.EndGroup();
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Misc");
        {
            Target.VerticesPerMesh     = SGT_EditorGUI.IntField("Vertices Per Mesh", "The maximum amount of vertices contained in each group of terrain patches. A surface can be represented by any number of meshes.", Target.VerticesPerMesh);
            Target.MinUpdateInterval   = SGT_EditorGUI.FloatField("Min Update Interval", "The time in seconds between each time the tessellator's update function is run. Set this to zero to only wait for the next frame.", Target.MinUpdateInterval);
            Target.TaskBudget          = SGT_EditorGUI.FloatField("Task Budget", "The amount of seconds allocated to the tessellator every frame. Set this to zero to spread the updating across as many frames as possible.", Target.TaskBudget);
            Target.MaxSplitsPerFrame   = SGT_EditorGUI.IntField("Max Splits Per Frame", "The maximum amount of patches that can be split/subdivided per frame.", Target.MaxSplitsPerFrame);
            Target.MaxStitchesPerFrame = SGT_EditorGUI.IntField("Max Stitches Per Frame", "The maximum amount of patches that can be stitched to neighbouring patches per frame.", Target.MaxStitchesPerFrame);
            //Target.SettleOnAwake       = SGT_EditorGUI.BoolField("Settle On Awake", null, Target.SettleOnAwake);
            Target.ReportBudget = SGT_EditorGUI.BoolField("Report Budget", "This will notify you when the tessellator's current task exceeds your specified budget by two times.", Target.ReportBudget);
        }
        SGT_EditorGUI.EndGroup();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.MarkNextFieldAsBold();
        Target.Rotation = SGT_EditorGUI.QuaternionField("Rotation", "The current orbit rotation.", Target.Rotation);

        SGT_EditorGUI.BeginIndent();
        {
            Target.RotationSpeed     = SGT_EditorGUI.FloatField("Speed", "The speed at which the camera can rotate.", Target.RotationSpeed);
            Target.RotationDampening = SGT_EditorGUI.FloatField("Dampening", "How sharp the rotation is. A higher value means the rotation will reach its destination quickly.", Target.RotationDampening);
            Target.RotationRequires  = (SGT_CameraFreeLook.LookKey)SGT_EditorGUI.EnumField("Requires", "Which mouse button must be held down for looking?", Target.RotationRequires);
        }
        SGT_EditorGUI.EndIndent();

        SGT_EditorGUI.Separator();
    }
Example #23
0
    public void OnGUI()
    {
        scrollPos = GUI.BeginScrollView(new Rect(0, 0, position.width, position.height), scrollPos, new Rect(0, 0, 0, height));

        SGT_EditorGUI.ResetAll();

        OnInspector();

        var r = SGT_EditorGUI.Reserve(0.0f, false);

        if (Event.current.type == EventType.Repaint)
        {
            height = r.y;
        }

        GUI.EndScrollView();
    }
Example #24
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Dust");
        {
            Target.DustTechnique   = (SGT_Dust.Technique)SGT_EditorGUI.EnumField("Technique", "The blending mode used by the dust particle shader.", Target.DustTechnique, true);
            Target.DustRenderQueue = SGT_EditorGUI.IntField("Render Queue", "The render queue used by the dust particle material.", Target.DustRenderQueue);
            Target.DustSeed        = SGT_EditorGUI.SeedField("Seed", "The random seed used when generating the dust particles.", Target.DustSeed);
            Target.DustCount       = SGT_EditorGUI.IntField("Count", "The amount of dust particles in the dust field.", Target.DustCount);
            Target.DustRadius      = SGT_EditorGUI.FloatField("Radius", "The maximum distance between the camera and a dust particle.", Target.DustRadius);
            Target.DustCamera      = SGT_EditorGUI.ObjectField("Camera", "The camera that's rendering this dust particles.", Target.DustCamera, true);
            Target.DustAutoRegen   = SGT_EditorGUI.BoolField("Auto Regen", "Automatically regenerate the dust particle mesh when making changes?", Target.DustAutoRegen);

            if (Target.DustAutoRegen == false)
            {
                SGT_EditorGUI.BeginFrozen(Target.DustModified == true);
                {
                    if (SGT_EditorGUI.Button("Regenerate") == true)
                    {
                        Target.Regenerate();
                    }
                }
                SGT_EditorGUI.EndFrozen();
            }
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Particle");
        {
            Target.ParticleTexture         = SGT_EditorGUI.ObjectField("Texture", "The texture applied to the dust particles.", Target.ParticleTexture, true);
            Target.ParticleColour          = SGT_EditorGUI.ColourField("Colour", "The colour of the dust particles.", Target.ParticleColour);
            Target.ParticleScale           = SGT_EditorGUI.FloatField("Scale", "The size of the dust particles relative to the size of the dust field.", Target.ParticleScale, 0.0f, 1.0f);
            Target.ParticleFadeInDistance  = SGT_EditorGUI.FloatField("Fade In Distance", "Sets how near the dust particles can get before they fade away.", Target.ParticleFadeInDistance, 0.0f, Target.DustRadius);
            Target.ParticleFadeOutDistance = SGT_EditorGUI.FloatField("Fade Out Distance", "Sets how far the dust particles can get before they fade away.", Target.ParticleFadeOutDistance, 0.0f, Target.DustRadius);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Source");
        {
            Target.SourceConfiguration = (SGT_SurfaceConfiguration)SGT_EditorGUI.EnumField("Configuration", null, Target.SourceConfiguration);
            Target.SourceSurfaceMesh   = SGT_EditorGUI.SurfaceMultiMeshField("Surface Mesh", "This should be a sphere with a radius of 1.", Target.SourceSurfaceMesh, true);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Displacement");
        {
            Target.DisplacementConfiguration = (SGT_SurfaceConfiguration)SGT_EditorGUI.EnumField("Configuration", null, Target.DisplacementConfiguration);
            Target.DisplacementTexture       = SGT_EditorGUI.Field("Texture", "This should be a grayscale texture where black is Scale Min and white is Scale Max.", Target.DisplacementTexture, true);
            Target.DisplacementScaleMin      = SGT_EditorGUI.FloatField("Scale Min", "The final mesh scale if the displacement texture was purely black.", Target.DisplacementScaleMin);
            Target.DisplacementScaleMax      = SGT_EditorGUI.FloatField("Scale Max", "The final mesh scale if the displacement texture was purely white.", Target.DisplacementScaleMax);

            SGT_EditorGUI.Separator();

            Target.DisplacementUseUV     = SGT_EditorGUI.BoolField("Use UV", "Use the UV data when sampling the displacement map. By default, the UV data will be calculated based on polar coordinates.", Target.DisplacementUseUV);
            Target.DisplacementClamp     = SGT_EditorGUI.BoolField("Clamp", "Prevent the texture sampling from wrapping around the texture.", Target.DisplacementClamp);
            Target.DisplacementAutoRegen = SGT_EditorGUI.BoolField("Auto Regen", null, Target.DisplacementAutoRegen);

            if (Target.DisplacementAutoRegen == false)
            {
                SGT_EditorGUI.BeginFrozen(Target.Modified == true);
                {
                    if (SGT_EditorGUI.Button("Regenerate") == true)
                    {
                        Target.Regenerate();
                    }
                }
                SGT_EditorGUI.EndFrozen();
            }
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
Example #26
0
    protected void SetAll(string propertyName)
    {
        var property = typeof(T).GetProperty(propertyName);

        if (property == null)
        {
            Debug.Log("Failed to find: " + propertyName);
        }

        var baseValue = property.GetValue(target, null);

        if (SGT_EditorGUI.FieldModified == true)
        {
            SGT_EditorGUI.FieldModified = false;

            foreach (var t in targets)
            {
                property.SetValue(t, baseValue, null);
            }
        }
        else
        {
            foreach (var t in targets)
            {
                if (t != null)
                {
                    var propertyValue = property.GetValue(t, null);
                    var nullCount     = (baseValue == null ? 1 : 0) + (propertyValue == null ? 1 : 0);

                    if (nullCount == 1 || (nullCount == 0 && baseValue.GetHashCode() != propertyValue.GetHashCode()))
                    {
                        var rect = SGT_EditorGUI.Reserve(28.0f);

                        EditorGUI.HelpBox(rect, "The above value differs among the selected objects. Modifying this will modify all of them.", MessageType.Warning);

                        break;
                    }
                }
            }
        }
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        for (var i = 0; i < Target.Count; i++)
        {
            var material    = Target.GetMaterial(i);
            var renderQueue = Target.GetRenderQueue(i);

            SGT_EditorGUI.BeginIndent();
            {
                bool pressed; material = SGT_EditorGUI.ObjectFieldWithButton("Material", null, material, "X", out pressed, 25.0f, true);

                renderQueue = SGT_EditorGUI.IntField("Render Queue", null, renderQueue);

                if (pressed == true)
                {
                    Target.Remove(i);
                }
                else
                {
                    Target.SetMaterial(material, i);
                    Target.SetRenderQueue(renderQueue, i);
                }
            }
            SGT_EditorGUI.EndIndent();

            SGT_EditorGUI.Separator();
        }

        var addMaterial = SGT_EditorGUI.ObjectField <Material>("Add Material", null, null);

        if (addMaterial != null)
        {
            Target.Add(addMaterial, addMaterial.renderQueue);
        }

        SGT_EditorGUI.Separator();
    }
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Snap");
        {
            Target.SnapSurface = SGT_EditorGUI.ObjectField("Surface", "The surface this object will be snapped to. Note: This GameObject must contain either the Planet or Star component.", Target.SnapSurface, true);

            if (Target.SnapSurface != null && SGT_SurfaceHelper.ContainsSurface(Target.SnapSurface) == false)
            {
                SGT_EditorGUI.HelpBox("The GameObject you have chosen above doesn't contain a surface (Planet or Star component).", MessageType.Warning);
            }

            SGT_EditorGUI.Separator();

            Target.SnapPosition = SGT_EditorGUI.BeginToggleGroup("Position", null, Target.SnapPosition);
            {
                Target.SnapPositionHeight = SGT_EditorGUI.FloatField("Height", "The height about the surface the object will be snapped to.", Target.SnapPositionHeight);
            }
            SGT_EditorGUI.EndToggleGroup();

            if (Target.SnapRotation == SGT_SnapToSurface.RotationSnap.AlignToNormal)
            {
                SGT_EditorGUI.MarkNextFieldAsBold();
                SGT_EditorGUI.Separator();
            }

            Target.SnapRotation = (SGT_SnapToSurface.RotationSnap)SGT_EditorGUI.EnumField("Rotation", "Should the rotation be snapped to the surface?", Target.SnapRotation);

            SGT_EditorGUI.BeginIndent(Target.SnapRotation == SGT_SnapToSurface.RotationSnap.AlignToNormal);
            {
                Target.SnapRotationScanDistance = SGT_EditorGUI.FloatField("Scan Distance", "The amount of units ahead the samples used to find the surface normal will extend.", Target.SnapRotationScanDistance);
            }
            SGT_EditorGUI.EndIndent();
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();
    }
Example #29
0
    public override void OnInspectorGUI()
    {
        var curEvent = Event.current;
        var snapshot = (curEvent.type != EventType.Repaint && curEvent.type != EventType.Layout) || SGT_AuxWindowHelper.instance != null;

        if (snapshot == true)
        {
            var undoTargets = new ObjectList();

            Target.BuildUndoTargets(undoTargets);

#if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
            Undo.SetSnapshotTarget(undoTargets.ToArray(), "Change to " + Target.name);
            Undo.CreateSnapshot();
#else
            Undo.RecordObjects(undoTargets.ToArray(), "Change to " + Target.name);
#endif
        }

        SGT_EditorGUI.ResetAll();

        OnInspector();

        if (SGT_EditorGUI.InspectorModified == true)
        {
            SGT_EditorGUI.InspectorModified = false;

            if (snapshot == true)
            {
#if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
                Undo.RegisterSnapshot();
#endif

                EditorUtility.SetDirty(target);
            }

            Repaint();
        }
    }
Example #30
0
    public override void OnInspector()
    {
        SGT_EditorGUI.Separator();

        SGT_EditorGUI.BeginGroup("Move");
        {
            Target.MovePlane         = (SGT_CameraMove.MovementPlane)SGT_EditorGUI.EnumField("Plane", "The axes the camera moves on.", Target.MovePlane);
            Target.MoveSpeed         = SGT_EditorGUI.FloatField("Speed", "The maximum speed the camera can move.", Target.MoveSpeed);
            Target.MoveSmooth        = SGT_EditorGUI.FloatField("Smooth", "The amount the movement speed is smoothed.", Target.MoveSmooth);
            Target.MoveShiftSpeedMul = SGT_EditorGUI.FloatField("Shift Speed Mul", "The amount the speed is multiplied by when holding shift.", Target.MoveShiftSpeedMul);
        }
        SGT_EditorGUI.EndGroup();

        SGT_EditorGUI.Separator();

        Target.RepelBodies = SGT_EditorGUI.BeginToggleGroup("Repel Bodies", "Makes it so the camera cannot enter planets or stars.", Target.RepelBodies);
        {
            Target.RepelDistance = SGT_EditorGUI.FloatField("Distance", "Specifies the minimum distance the camera can be from a planet or star.", Target.RepelDistance);
        }
        SGT_EditorGUI.EndToggleGroup();

        SGT_EditorGUI.Separator();
    }