public static bool DrawButton(Coord coord, MatrixBuilding matrix) { CoolEditor.SetHandlesMatrix(matrix.transform.localToWorldMatrix); bool clicked = false; bool exists = matrix.pieces.ContainsKey(coord) && matrix.pieces[coord]; CoolEditor.SetHandlesColor(exists? Color.red: Color.green); float size = FloorTile.tileSize * 0.2f; Vector3 pos = coord.ToWorld() + new Vector3(-1, 0, 1) * FloorTile.tileSize * 0.5f; if (Handles.Button(pos, Quaternion.Euler(90, 0, 0), size, size, Handles.CircleHandleCap)) { if (exists) { matrix.Remove(coord); } else { matrix.Add(coord); } matrix.Blend(coord); clicked = true; } CoolEditor.RestoreHandlesColor(); CoolEditor.RestoreHandlesMatrix(); return(clicked); }
void OnSceneGUI() { CoolEditor.SetHandlesColor(new Color(1, 1, 0, 1)); UselessSceneGUI(); Handles.ArrowHandleCap(0, Target.transform.position + Target.GlobalForward * 0.5f, Quaternion.LookRotation(Target.GlobalForward), 1, EventType.Repaint); CoolEditor.RestoreHandlesColor(); }