feat: first level configured
This commit is contained in:
parent
9a5b06387d
commit
2f297461e3
5 changed files with 123698 additions and 111654 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -8,7 +8,7 @@ Material:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: EarthMaterial
|
||||
m_Shader: {fileID: 4800000, guid: 32a0ef2a7ef59ad47846655a3c02fa8d, type: 3}
|
||||
m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
|
|
@ -27,6 +27,10 @@ Material:
|
|||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _AlphaTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 2800000, guid: c2fa05cb71836f246b5eabf3f3c6151c, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
|
|
@ -36,7 +40,7 @@ Material:
|
|||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _CloudsTex:
|
||||
m_Texture: {fileID: 2800000, guid: 961fa74443856d247867fce623b3d325, type: 3}
|
||||
m_Texture: {fileID: 2800000, guid: 7dfcb90673cf9a44281e7da0b32902b2, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _Cube:
|
||||
|
|
@ -113,6 +117,7 @@ Material:
|
|||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- PixelSnap: 0
|
||||
- _AtmosFalloff: 14
|
||||
- _BumpScale: 1
|
||||
- _CloudIntensityMin: 0.1
|
||||
|
|
@ -121,6 +126,7 @@ Material:
|
|||
- _DetailIntensityMin: 0.01
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _EnableExternalAlpha: 0
|
||||
- _Glossiness: 0.5
|
||||
- _InvFade: 1
|
||||
- _LightScale: 1
|
||||
|
|
@ -146,7 +152,9 @@ Material:
|
|||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _DayTintColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0.04, g: 0.04, b: 0.04, a: 1}
|
||||
- _Flip: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ReflectColor: {r: 1, g: 1, b: 1, a: 0.5}
|
||||
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _RimColor: {r: 0, g: 0.27520287, b: 0.5955882, a: 0}
|
||||
- _SpecColor: {r: 0.08823532, g: 0.08823532, b: 0.08823532, a: 1}
|
||||
- _SunColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using NUnit.Framework.Internal.Commands;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public static class EditorCustom
|
||||
|
|
@ -71,7 +72,8 @@ public static class EditorCustom
|
|||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
gm.maxConnectionLength = EditorGUILayout.Slider("Max Connection Length", gm.maxConnectionLength, 0, 100);
|
||||
gm.minConnectionLength = EditorGUILayout.Slider("Min Connection Length", gm.minConnectionLength, 0, gm.maxConnectionLength);
|
||||
gm.maxConnectionLength = EditorGUILayout.Slider("Max Connection Length", gm.maxConnectionLength, gm.minConnectionLength, 30);
|
||||
if (EditorGUI.EndChangeCheck() && gm.regenerateOnChange)
|
||||
{
|
||||
gm.GenerateConnections();
|
||||
|
|
@ -114,14 +116,8 @@ public static class EditorCustom
|
|||
|
||||
|
||||
if (GUILayout.Button("Fetch all Nodes"))
|
||||
{
|
||||
Node[] allNodes = gm.NodeParent.GetComponentsInChildren<Node>();
|
||||
|
||||
Debug.Log("Added " + (allNodes.Length - gm.nodeCount) + " new nodes");
|
||||
|
||||
gm.nodes = allNodes.ToList();
|
||||
gm.nodeCount = allNodes.Length;
|
||||
}
|
||||
gm.FetchAllNodes();
|
||||
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public class GameManager : MonoBehaviour
|
|||
|
||||
public bool regenerateOnChange = false;
|
||||
|
||||
[HideInInspector] public float minConnectionLength = 6;
|
||||
[HideInInspector] public float maxConnectionLength = 6;
|
||||
[HideInInspector] public int nodeCount = 100;
|
||||
[HideInInspector] public int hoverRadiusCon = 50;
|
||||
|
|
@ -57,6 +58,7 @@ public class GameManager : MonoBehaviour
|
|||
public bool allowed = true;
|
||||
}
|
||||
|
||||
public float minConnectionLength = 0;
|
||||
public float maxConnectionLength = 0;
|
||||
public List<NodeData> nodes = new List<NodeData>();
|
||||
public List<ConnectionData> connections = new List<ConnectionData>();
|
||||
|
|
@ -121,7 +123,8 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
if (nodeB == null) continue;
|
||||
bool conExists = false;
|
||||
if (nodeA == nodeB || Math.Abs(Vector3.Distance(nodeA.transform.position, nodeB.transform.position)) > maxConnectionLength)
|
||||
float dist = Vector3.Distance(nodeA.transform.position, nodeB.transform.position);
|
||||
if (nodeA == nodeB || dist > maxConnectionLength)
|
||||
continue;
|
||||
|
||||
foreach (Connection con in connections)
|
||||
|
|
@ -134,13 +137,21 @@ public class GameManager : MonoBehaviour
|
|||
}
|
||||
if (!conExists)
|
||||
{
|
||||
AddConnection(nodeA, nodeB);
|
||||
AddConnection(nodeA, nodeB, dist < minConnectionLength);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void FetchAllNodes()
|
||||
{
|
||||
Node[] allNodes = NodeParent.GetComponentsInChildren<Node>();
|
||||
|
||||
nodes = allNodes.ToList();
|
||||
nodeCount = allNodes.Length;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
foreach (var con in connections)
|
||||
|
|
@ -210,19 +221,19 @@ public class GameManager : MonoBehaviour
|
|||
|
||||
foreach (LevelData.ConnectionData conData in levels[index].connections)
|
||||
{
|
||||
AddConnection(nodes[conData.nodeAIndex], nodes[conData.nodeBIndex]);
|
||||
AddConnection(nodes[conData.nodeAIndex], nodes[conData.nodeBIndex], conData.allowed);
|
||||
}
|
||||
selectedLevel = index;
|
||||
minConnectionLength = levels[index].minConnectionLength;
|
||||
maxConnectionLength = levels[index].maxConnectionLength;
|
||||
nodeCount = nodes.Count;
|
||||
|
||||
Debug.Log("Loaded Level " + index);
|
||||
}
|
||||
|
||||
public void SaveLevelData(int index = -1)
|
||||
{
|
||||
LevelData data = new LevelData();
|
||||
|
||||
data.minConnectionLength = minConnectionLength;
|
||||
data.maxConnectionLength = maxConnectionLength;
|
||||
|
||||
// Nodes speichern
|
||||
|
|
@ -258,7 +269,5 @@ public class GameManager : MonoBehaviour
|
|||
|
||||
int newIndex = index < 0 ? levels.Count - 1 : index;
|
||||
selectedLevel = newIndex;
|
||||
|
||||
Debug.Log("Saved Level " + newIndex);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[ExecuteAlways]
|
||||
public class Node : MonoBehaviour
|
||||
|
|
@ -32,10 +33,26 @@ public class Node : MonoBehaviour
|
|||
UpdateTransform();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
GameManager gm = FindFirstObjectByType<GameManager>();
|
||||
|
||||
List<GameManager.Connection> looseConnections = gm.connections.FindAll(c => c.nodeA == this || c.nodeB == this);
|
||||
|
||||
foreach(GameManager.Connection c in looseConnections)
|
||||
{
|
||||
DestroyImmediate(c.lineRenderer.gameObject);
|
||||
gm.connections.Remove(c);
|
||||
}
|
||||
|
||||
gm.FetchAllNodes();
|
||||
}
|
||||
|
||||
public void UpdateTransform()
|
||||
{
|
||||
transform.localPosition = transform.localPosition.normalized * 20f;
|
||||
transform.forward = transform.position;
|
||||
if(transform.position != Vector3.zero)
|
||||
transform.forward = transform.position;
|
||||
}
|
||||
|
||||
public void UpdateColor()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue