-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
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,14 @@ | ||
%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: 45c75db90df8f164eb7526b4160507df, type: 3} | ||
m_Name: Default Randomizer | ||
m_EditorClassIdentifier: |
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,17 @@ | ||
{ | ||
"name": "Dreamteck.Forever", | ||
"rootNamespace": "", | ||
"references": [ | ||
"GUID:2fdef4a859838e3449b625605ab13c25", | ||
"GUID:fcf26afa24f209f48995057e40e2e83e" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
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.
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,59 @@ | ||
namespace Dreamteck.Forever.Editor | ||
{ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEditor; | ||
|
||
|
||
[CustomEditor(typeof(ActiveRandomChildren))] | ||
public class ActiveRandomChildrenEditor : Editor | ||
{ | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
base.OnInspectorGUI(); | ||
ActiveRandomChildren active = (ActiveRandomChildren)target; | ||
int childCount = active.transform.childCount; | ||
EditorGUILayout.LabelField("Total: " + childCount + " (Min " + Mathf.RoundToInt(childCount * active.minPercent) + ") - (Max " + Mathf.RoundToInt(childCount * active.maxPercent) + ")"); | ||
if (GUILayout.Button("Preview density")) | ||
{ | ||
List<GameObject> children = new List<GameObject>(); | ||
foreach (Transform child in active.transform) | ||
{ | ||
child.gameObject.SetActive(false); | ||
children.Add(child.gameObject); | ||
} | ||
float percent = Mathf.Lerp(active.minPercent, active.maxPercent, Random.Range(0f, 1f)); | ||
int activeCount = Mathf.RoundToInt(childCount * percent); | ||
for (int i = 0; i < activeCount; i++) | ||
{ | ||
int rand = Random.Range(0, children.Count); | ||
children[rand].SetActive(true); | ||
children.RemoveAt(rand); | ||
} | ||
} | ||
|
||
if (GUILayout.Button("Activate All")) | ||
{ | ||
foreach (Transform child in active.transform) | ||
{ | ||
child.gameObject.SetActive(true); | ||
} | ||
} | ||
|
||
if (GUILayout.Button("Deactivate All")) | ||
{ | ||
foreach (Transform child in active.transform) | ||
{ | ||
child.gameObject.SetActive(false); | ||
} | ||
} | ||
} | ||
|
||
float CeilFloat(float number, int digitsAfterPoint) | ||
{ | ||
return Mathf.Ceil(number * (float)Mathf.Pow(10, digitsAfterPoint)) / (float)Mathf.Pow(10, digitsAfterPoint); | ||
} | ||
} | ||
} |
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,40 @@ | ||
namespace Dreamteck.Forever | ||
{ | ||
using UnityEngine; | ||
using UnityEditor; | ||
using System; | ||
|
||
public class CreateCustomSequenceWindow : EditorWindow | ||
{ | ||
Type[] sequenceTypes = new Type[0]; | ||
Vector2 scroll = Vector2.zero; | ||
|
||
[MenuItem("Assets/Create/Forever/Custom Sequence")] | ||
public static void CreateWindow() | ||
{ | ||
GetWindow<CreateCustomSequenceWindow>(true); | ||
} | ||
|
||
private void OnEnable() | ||
{ | ||
titleContent = new GUIContent("New Custom Sequence"); | ||
sequenceTypes = FindDerivedClasses.GetAllDerivedClasses(typeof(CustomSequence)).ToArray(); | ||
} | ||
|
||
private void OnGUI() | ||
{ | ||
scroll = EditorGUILayout.BeginScrollView(scroll); | ||
for (int i = 0; i < sequenceTypes.Length; i++) | ||
{ | ||
string btnTxt = sequenceTypes[i].ToString(); | ||
if (btnTxt.StartsWith("Dreamteck.Forever.")) btnTxt = btnTxt.Substring("Dreamteck.Forever.".Length); | ||
if (GUILayout.Button(btnTxt)) | ||
{ | ||
Selection.activeObject = ScriptableObjectUtility.CreateAsset(sequenceTypes[i].ToString(), btnTxt); | ||
Close(); | ||
} | ||
} | ||
EditorGUILayout.EndScrollView(); | ||
} | ||
} | ||
} |
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,40 @@ | ||
namespace Dreamteck.Forever | ||
{ | ||
using UnityEngine; | ||
using UnityEditor; | ||
using System; | ||
|
||
public class CreatePathGeneratorWindow : EditorWindow | ||
{ | ||
Type[] generatorTypes = new Type[0]; | ||
Vector2 scroll = Vector2.zero; | ||
|
||
[MenuItem("Assets/Create/Forever/Path Generator")] | ||
public static void CreateWindow() | ||
{ | ||
GetWindow<CreatePathGeneratorWindow>(true); | ||
} | ||
|
||
private void OnEnable() | ||
{ | ||
titleContent = new GUIContent("New Path Generator"); | ||
generatorTypes = FindDerivedClasses.GetAllDerivedClasses(typeof(LevelPathGenerator)).ToArray(); | ||
} | ||
|
||
private void OnGUI() | ||
{ | ||
scroll = EditorGUILayout.BeginScrollView(scroll); | ||
for (int i = 0; i < generatorTypes.Length; i++) | ||
{ | ||
string btnTxt = generatorTypes[i].ToString(); | ||
if (btnTxt.StartsWith("Dreamteck.Forever.")) btnTxt = btnTxt.Substring("Dreamteck.Forever.".Length); | ||
if (GUILayout.Button(btnTxt)) | ||
{ | ||
Selection.activeObject = ScriptableObjectUtility.CreateAsset(generatorTypes[i].ToString(), btnTxt); | ||
Close(); | ||
} | ||
} | ||
EditorGUILayout.EndScrollView(); | ||
} | ||
} | ||
} |
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,40 @@ | ||
namespace Dreamteck.Forever | ||
{ | ||
using UnityEngine; | ||
using UnityEditor; | ||
using System; | ||
|
||
public class CreateSegmentShuffleWindow : EditorWindow | ||
{ | ||
Type[] randomizerTypes = new Type[0]; | ||
Vector2 scroll = Vector2.zero; | ||
|
||
[MenuItem("Assets/Create/Forever/Segment Shuffle")] | ||
public static void CreateWindow() | ||
{ | ||
GetWindow<CreateSegmentShuffleWindow>(true); | ||
} | ||
|
||
private void OnEnable() | ||
{ | ||
titleContent = new GUIContent("New Segment Shuffle"); | ||
randomizerTypes = FindDerivedClasses.GetAllDerivedClasses(typeof(SegmentShuffle)).ToArray(); | ||
} | ||
|
||
private void OnGUI() | ||
{ | ||
scroll = EditorGUILayout.BeginScrollView(scroll); | ||
for (int i = 0; i < randomizerTypes.Length; i++) | ||
{ | ||
string btnTxt = randomizerTypes[i].ToString(); | ||
if (btnTxt.StartsWith("Dreamteck.Forever.")) btnTxt = btnTxt.Substring("Dreamteck.Forever.".Length); | ||
if (GUILayout.Button(btnTxt)) | ||
{ | ||
Selection.activeObject = ScriptableObjectUtility.CreateAsset(randomizerTypes[i].ToString(), btnTxt); | ||
Close(); | ||
} | ||
} | ||
EditorGUILayout.EndScrollView(); | ||
} | ||
} | ||
} |
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,22 @@ | ||
{ | ||
"name": "Dreamteck.Forever.Editor", | ||
"rootNamespace": "", | ||
"references": [ | ||
"GUID:b94a1c673e7bfea4ebba04b756a26be8", | ||
"GUID:fcf26afa24f209f48995057e40e2e83e", | ||
"GUID:e1858e8552db82d4dabda17b0cadb7dd", | ||
"GUID:2fdef4a859838e3449b625605ab13c25", | ||
"GUID:dccd6f29df4cff34588f7344b286192f" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.