Mappp
This commit is contained in:
@@ -23,6 +23,7 @@ public sealed class MapCoordinateSystemEditor : Editor
|
||||
DrawCorners(coordinateSystem);
|
||||
DrawCrosshairs(coordinateSystem);
|
||||
DrawTargets(coordinateSystem);
|
||||
DrawPlayers(coordinateSystem);
|
||||
}
|
||||
|
||||
private static void DrawGrid(MapCoordinateSystem coordinateSystem)
|
||||
@@ -140,6 +141,23 @@ public sealed class MapCoordinateSystemEditor : Editor
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawPlayers(MapCoordinateSystem coordinateSystem)
|
||||
{
|
||||
MapPlayer[] players = Object.FindObjectsByType<MapPlayer>(FindObjectsSortMode.None);
|
||||
foreach (MapPlayer mapPlayer in players)
|
||||
{
|
||||
if (mapPlayer.CoordinateSystem != null && mapPlayer.CoordinateSystem != coordinateSystem)
|
||||
continue;
|
||||
|
||||
Vector3 position = mapPlayer.transform.position;
|
||||
Vector2 coordinates = coordinateSystem.WorldPositionToCoordinates(position);
|
||||
Handles.Label(
|
||||
position,
|
||||
$"MapPlayer ({coordinates.x:0.00}, {coordinates.y:0.00})",
|
||||
CreateLabelStyle(Color.green));
|
||||
}
|
||||
}
|
||||
|
||||
private static GUIStyle CreateLabelStyle(Color color)
|
||||
{
|
||||
GUIStyle style = new(EditorStyles.boldLabel);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomEditor(typeof(MapTargetController))]
|
||||
public sealed class MapTargetControllerEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
using (new EditorGUI.DisabledScope(!Application.isPlaying))
|
||||
{
|
||||
if (GUILayout.Button("Start Next Wave"))
|
||||
((MapTargetController)target).StartNextWave();
|
||||
}
|
||||
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
EditorGUILayout.HelpBox(
|
||||
"Start Next Wave becomes available in Play Mode.",
|
||||
MessageType.Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09f50d05321d420f86622f0dc7a6fa14
|
||||
Reference in New Issue
Block a user