Beispiel #1
0
    public bool IntersectsWith(DynEnumSet <T> other)
    {
        var a = this.dynEnumList;
        var b = other.dynEnumList;

        for (int aI = 0; aI < a.Count; ++aI)
        {
            for (int bI = 0; bI < b.Count; ++bI)
            {
                if (a[aI] == b[bI])
                {
                    return(true);
                }
            }
        }
        return(false);
    }
Beispiel #2
0
    protected DynEnumSet <T> GetSet()
    {
#if IS_RELEASE || !UNITY_EDITOR
        if (_cachedSet != null)
        {
            return(_cachedSet);
        }
#endif // IS_RELEASE || !UNITY_EDITOR

        using (var dynEnums = TempList <T> .Get())
        {
            for (int i = 0; i < dynEnumNames.Length; ++i)
            {
                T dynEnum = GetDynEnumByName(dynEnumNames[i]);
                dynEnums.Add(dynEnum);
            }

#if !IS_RELEASE && UNITY_EDITOR
            if (_cachedSet != null && dynEnums.Count == _cachedSet.dynEnumList.Count)
            {
                bool dirty = false;
                for (int i = 0; i < _cachedSet.dynEnumList.Count; ++i)
                {
                    if (dynEnums[i] != _cachedSet.dynEnumList[i])
                    {
                        dirty = true;
                        break;
                    }
                }

                if (!dirty)
                {
                    return(_cachedSet);
                }
            }
#endif // !IS_RELEASE && UNITY_EDITOR

            _cachedSet = CreateDynEnumSet(new List <T>(dynEnums.buffer));
        }

        return(_cachedSet);
    }
Beispiel #3
0
 public void Set(DynEnumSet <T> dynEnums)
 {
     Set(dynEnums.dynEnumList);
 }
Beispiel #4
0
 // Relative Complement
 public void Remove(DynEnumSet <T> other)
 {
     Remove(other.dynEnumList);
 }
Beispiel #5
0
 // Union
 public void Add(DynEnumSet <T> other)
 {
     Add(other.dynEnumList);
 }