diff --git a/Assets/NodeMaterialNone.mat b/Assets/NodeMaterialNone.mat index c18c42d..566bf44 100644 --- a/Assets/NodeMaterialNone.mat +++ b/Assets/NodeMaterialNone.mat @@ -117,8 +117,8 @@ Material: - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: - - _BaseColor: {r: 0.46226418, g: 0.46226418, b: 0.46226418, a: 1} - - _Color: {r: 0.46226412, g: 0.46226412, b: 0.46226412, a: 1} + - _BaseColor: {r: 0, g: 0, b: 0, a: 1} + - _Color: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} m_BuildTextureStacks: [] diff --git a/Assets/Scripts/Connection.cs b/Assets/Scripts/Connection.cs index eb9f0a4..3edc2b7 100644 --- a/Assets/Scripts/Connection.cs +++ b/Assets/Scripts/Connection.cs @@ -42,5 +42,4 @@ public class Connection : MonoBehaviour hovered = false; } - } diff --git a/Assets/Scripts/Node.cs b/Assets/Scripts/Node.cs index 30de6b9..61edaae 100644 --- a/Assets/Scripts/Node.cs +++ b/Assets/Scripts/Node.cs @@ -19,6 +19,8 @@ public class Node : MonoBehaviour public bool hovered; + private int Nachos = 0; + public static Node pressedNode = null; void Awake() @@ -31,6 +33,17 @@ public class Node : MonoBehaviour { } + private void FixedUpdate() + { + CalculateNachos(); + } + + + void CalculateNachos() + { + Nachos = CycleFinder.FindLargestCycleAmongNeighbors(this).Count; + } + // Update is called once per frame void Update() { @@ -38,13 +51,11 @@ public class Node : MonoBehaviour if (Input.GetMouseButtonDown(0) && hovered) { - var count = CycleFinder.FindLargestCycleAmongNeighbors(this); - - Debug.Log($"Largest Nacho: {count.Count}"); + Debug.Log($"Largest Nacho: {Nachos}"); } unitText.enabled = hovered; - unitText.text = Units.ToString(); + unitText.text = Nachos.ToString(); unitText.transform.forward = Camera.main.transform.forward; UpdateColor(); UpdateTransform(); @@ -106,17 +117,19 @@ public class CycleFinder private HashSet allowedNodes; private List bestCycle; private Node centerNode; + private int Owner; - public CycleFinder(Node center) + public CycleFinder(Node center, int owner) { centerNode = center; - allowedNodes = new HashSet(center.connected); + allowedNodes = new HashSet(center.connected.Where(obj => obj.Owner == owner)); bestCycle = new List(); + Owner = owner; } public static List FindLargestCycleAmongNeighbors(Node center) { - var finder = new CycleFinder(center); + var finder = new CycleFinder(center, center.Owner); return finder.FindBestCycle(); }