-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
…t object
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
[CreateAssetMenu()] | ||
public class ColorSettings : ScriptableObject | ||
{ | ||
public Color planetColor; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEditor; | ||
|
||
[CustomEditor(typeof(Planet))] | ||
public class PlanetEditor : Editor | ||
{ | ||
Planet planet; | ||
public override void OnInspectorGUI() { | ||
base.OnInspectorGUI(); | ||
|
||
DrawSettingsEditor(Planet.shapeSettings); | ||
DrawSettingsEditor(Planet.colorSettings); | ||
} | ||
|
||
void DrawSettingsEditor(Object settings) { | ||
Editor editor = CreateEditor(settings); | ||
// Display it | ||
editor.OnInspectorGUI(); | ||
} | ||
|
||
private void OnEnable() { | ||
planet = (Planet)target; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: dbfd93a1135b5497d9739bd17599d359, type: 3} | ||
m_Name: Color | ||
m_EditorClassIdentifier: | ||
planetColor: {r: 0, g: 0.8565588, b: 1, a: 0} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: a9b63090aeeb0411bbf8ce26688c294f, type: 3} | ||
m_Name: Shape | ||
m_EditorClassIdentifier: | ||
planetRadius: 2 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class ShapeGenerator | ||
{ | ||
ShapeSettings settings; // Assigned in the constructor | ||
public ShapeGenerator(ShapeSettings settings) { | ||
this.settings = settings; | ||
} | ||
|
||
public Vector3 CalculatePointOnPlanet(Vector3 pointOnUnitSphere) { | ||
return pointOnUnitSphere * settings.planetRadius; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
[CreateAssetMenu()] | ||
public class ShapeSettings : ScriptableObject { | ||
public float planetRadius = 1; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.