FiE-Game/Assets/Highlighting System/Scripts/Internal/HighlighterManager.cs

46 lines
856 B
C#
Raw Normal View History

2023-07-27 13:48:00 +02:00
using UnityEngine;
using UnityEngine.Rendering;
using System.Collections;
using System.Collections.Generic;
namespace HighlightingSystem
{
static public class HighlighterManager
{
static private int dirtyFrame = -1;
static public bool isDirty
{
get
{
return dirtyFrame == Time.frameCount;
}
private set
{
dirtyFrame = value ? Time.frameCount : -1;
}
}
static private HashSet<Highlighter> highlighters = new HashSet<Highlighter>();
//
static public void Add(Highlighter highlighter)
{
highlighters.Add(highlighter);
}
//
static public void Remove(Highlighter instance)
{
if (highlighters.Remove(instance) && instance.highlighted)
{
isDirty = true;
}
}
//
static public HashSet<Highlighter>.Enumerator GetEnumerator()
{
return highlighters.GetEnumerator();
}
}
}