public bool apply(Entity entity)
        {
            foreach (Type componentType in ComponentTypes)
            {
                if (!entity.HasComponent(componentType))
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #2
0
        public bool Matches(Entity entity)
        {
            foreach (Type component in _allComponents)
            {
                if (!entity.HasComponent(component))
                {
                    return(false);
                }
            }

            if (_oneComponents.Length > 0)
            {
                bool hasOne = false;
                foreach (Type component in _oneComponents)
                {
                    if (entity.HasComponent(component))
                    {
                        hasOne = true;
                        break;
                    }
                }

                if (!hasOne)
                {
                    return(false);
                }
            }

            foreach (Type component in _noneComponents)
            {
                if (entity.HasComponent(component))
                {
                    return(false);
                }
            }

            return(true);
        }
        public bool Match(Entity entity)
        {
            if (RequireComponentNames.Length < 1)
            {
                return(false);
            }
            foreach (string s in RequireComponentNames)
            {
                if (!entity.HasComponent(s))
                {
                    return(false);
                }
            }

            CurrentEntity = entity;
            return(true);
        }