//[UnityEditor.DrawGizmo(UnityEditor.GizmoType.NonSelected | UnityEditor.GizmoType.Active)] static public void Draw(UnityEditor.SceneView sceneView) //(Transform objectTransform, UnityEditor.GizmoType gizmoType) { foreach (var kvp in allGizmos) { GizmoGroup group = kvp.Value; if (!group.enabled) { continue; } if (group.colorOverride) { UnityEditor.Handles.color = group.color; } for (int i = 0; i < group.gizmos.Count; i++) { if (!group.colorOverride) { UnityEditor.Handles.color = group.gizmos[i].Color; } group.gizmos[i].Draw(); } } //allGizmos.Clear(); //will show gizmos only the frame they were assigned }
private static void AddGizmo(string name, IGizmo gizmo, Color color, bool clearOthers = false) { if (color.r == 0 && color.g == 0 && color.b == 0 && color.a == 0) { color = Color.white; } gizmo.Color = color; if (allGizmos.TryGetValue(name, out GizmoGroup group)) { if (clearOthers) { group.gizmos.Clear(); } group.gizmos.Add(gizmo); allGizmos[name] = group; } else { group = new GizmoGroup(); group.gizmos.Add(gizmo); allGizmos.Add(name, group); } }
static void WriteGizmoActor(StreamWriter writer, Actor actor) { int teamID = 0; if (actor.TagMap.ContainsKey(ActorKeys.TeamID)) { teamID = actor.TagMap[ActorKeys.TeamID]; } GizmoGroup group = actor.TagMap[ActorKeys.GizmoGroup]; writer.WriteLine(" {{ {0}, new Gizmo({0}, {1}, {2}) }},", actor.Header.SNOId, (int)group, teamID); }
internal Gizmo(int snoID, int gizmoGroup, int teamID) : base(snoID, (int)ActorCategory.Gizmo, teamID) { GizmoType = (GizmoGroup)gizmoGroup; }