public void OnGUI() { GUILayout.BeginArea(new Rect(5f, 5f, 220f, (float)(Screen.height - 10)), string.Empty, "Box"); switch (this.activeDemo) { case PathTypesDemo.DemoMode.ABPath: GUILayout.Label("Basic path. Finds a path from point A to point B.", new GUILayoutOption[0]); break; case PathTypesDemo.DemoMode.MultiTargetPath: GUILayout.Label("Multi Target Path. Finds a path quickly from one point to many others in a single search.", new GUILayoutOption[0]); break; case PathTypesDemo.DemoMode.RandomPath: GUILayout.Label("Randomized Path. Finds a path with a specified length in a random direction or biased towards some point when using a larger aim strenggth.", new GUILayoutOption[0]); break; case PathTypesDemo.DemoMode.FleePath: GUILayout.Label("Flee Path. Tries to flee from a specified point. Remember to set Flee Strength!", new GUILayoutOption[0]); break; case PathTypesDemo.DemoMode.ConstantPath: GUILayout.Label("Finds all nodes which it costs less than some value to reach.", new GUILayoutOption[0]); break; case PathTypesDemo.DemoMode.FloodPath: GUILayout.Label("Searches the whole graph from a specific point. FloodPathTracer can then be used to quickly find a path to that point", new GUILayoutOption[0]); break; case PathTypesDemo.DemoMode.FloodPathTracer: GUILayout.Label("Traces a path to where the FloodPath started. Compare the claculation times for this path with ABPath!\nGreat for TD games", new GUILayoutOption[0]); break; } GUILayout.Space(5f); GUILayout.Label("Note that the paths are rendered without ANY post-processing applied, so they might look a bit edgy", new GUILayoutOption[0]); GUILayout.Space(5f); GUILayout.Label("Click anywhere to recalculate the path. Hold Alt to continuously recalculate the path while the mouse is pressed.", new GUILayoutOption[0]); if (this.activeDemo == PathTypesDemo.DemoMode.ConstantPath || this.activeDemo == PathTypesDemo.DemoMode.RandomPath || this.activeDemo == PathTypesDemo.DemoMode.FleePath) { GUILayout.Label("Search Distance (" + this.searchLength + ")", new GUILayoutOption[0]); this.searchLength = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)this.searchLength, 0f, 100000f, new GUILayoutOption[0])); } if (this.activeDemo == PathTypesDemo.DemoMode.RandomPath || this.activeDemo == PathTypesDemo.DemoMode.FleePath) { GUILayout.Label("Spread (" + this.spread + ")", new GUILayoutOption[0]); this.spread = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)this.spread, 0f, 40000f, new GUILayoutOption[0])); GUILayout.Label(string.Concat(new object[] { (this.activeDemo != PathTypesDemo.DemoMode.RandomPath) ? "Flee strength" : "Aim strength", " (", this.aimStrength, ")" }), new GUILayoutOption[0]); this.aimStrength = GUILayout.HorizontalSlider(this.aimStrength, 0f, 1f, new GUILayoutOption[0]); } if (this.activeDemo == PathTypesDemo.DemoMode.MultiTargetPath) { GUILayout.Label("Hold shift and click to add new target points. Hold ctr and click to remove all target points", new GUILayoutOption[0]); } if (GUILayout.Button("A to B path", new GUILayoutOption[0])) { this.activeDemo = PathTypesDemo.DemoMode.ABPath; } if (GUILayout.Button("Multi Target Path", new GUILayoutOption[0])) { this.activeDemo = PathTypesDemo.DemoMode.MultiTargetPath; } if (GUILayout.Button("Random Path", new GUILayoutOption[0])) { this.activeDemo = PathTypesDemo.DemoMode.RandomPath; } if (GUILayout.Button("Flee path", new GUILayoutOption[0])) { this.activeDemo = PathTypesDemo.DemoMode.FleePath; } if (GUILayout.Button("Constant Path", new GUILayoutOption[0])) { this.activeDemo = PathTypesDemo.DemoMode.ConstantPath; } if (GUILayout.Button("Flood Path", new GUILayoutOption[0])) { this.activeDemo = PathTypesDemo.DemoMode.FloodPath; } if (GUILayout.Button("Flood Path Tracer", new GUILayoutOption[0])) { this.activeDemo = PathTypesDemo.DemoMode.FloodPathTracer; } GUILayout.EndArea(); }