Пример #1
0
        /// Returns all indices of added components.
        public int[] GetComponentIndices()
        {
            if (mComponentIndicesCache == null)
            {
                var indices = EntitasCache.GetIntList();

                for (int i = 0; i < mComponents.Length; i++)
                {
                    if (mComponents[i] != null)
                    {
                        indices.Add(i);
                    }
                }

                mComponentIndicesCache = indices.ToArray();

                EntitasCache.PushIntList(indices);
            }

            return(mComponentIndicesCache);
        }
Пример #2
0
        static int[] mergeIndices(int[] allOfIndices, int[] anyOfIndices, int[] noneOfIndices)
        {
            var indicesList = EntitasCache.GetIntList();

            if (allOfIndices != null)
            {
                indicesList.AddRange(allOfIndices);
            }
            if (anyOfIndices != null)
            {
                indicesList.AddRange(anyOfIndices);
            }
            if (noneOfIndices != null)
            {
                indicesList.AddRange(noneOfIndices);
            }

            var mergedIndices = distinctIndices(indicesList);

            EntitasCache.PushIntList(indicesList);

            return(mergedIndices);
        }