예제 #1
0
        public void DataDrivenMethod(Entity entity, NormalComponent com)
        {
            if (entity == null)
            {
                return;
            }
            int             sharedId        = com.SharedId;
            SharedComponent sharedComponent = null;

            if (sharedId > 0)
            {
                sharedComponent = _sharedComponentDic[sharedId];
            }
            int count = _systemReactiveDic.Count;

            for (int i = 0; i < count; i++)
            {
                ReactiveSystemDto dto = _systemReactiveDic[i];
                ComponentFlag     executeCondition        = dto.CurrentSystem.ExecuteCondition;
                ComponentFlag     reactiveCondition       = dto.CurrentSystem.ReactiveCondition;
                ComponentFlag     reactiveIgnoreCondition = dto.CurrentSystem.ReactiveIgnoreCondition;
                if (!reactiveCondition.HasFlag(com.OperatorId))
                {
                    continue;
                }
                if (sharedId > 0)
                {
                    foreach (Entity setEntity in sharedComponent.SharedEntityHashSet)
                    {
                        if (setEntity.GetComponentFlag().HasFlag(reactiveIgnoreCondition))
                        {
                            continue;
                        }
                        if (setEntity.GetComponentFlag().HasFlag(executeCondition))
                        {
                            dto.EntityHashSet.Add(setEntity);
                        }
                    }
                }
                else
                {
                    if (entity.GetComponentFlag().HasFlag(reactiveIgnoreCondition))
                    {
                        continue;
                    }
                    if (entity.GetComponentFlag().HasFlag(executeCondition))
                    {
                        dto.EntityHashSet.Add(entity);
                    }
                }
            }
        }
예제 #2
0
        public ComponentFlag GetFlag(params Int64[] args)
        {
            ComponentFlag flag = new ComponentFlag();

            if (args != null)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (!flag.HasFlag(args[i]))
                    {
                        flag.SetFlag(args[i]);
                    }
                }
            }
            return(flag);
        }
예제 #3
0
        public Group MatchGetGroup(params Int64[] componentIds)
        {
            if (componentIds == null)
            {
                throw new Exception("ComponentIds is null");
            }
            ComponentFlag flag = new ComponentFlag();

            for (int i = 0; i < componentIds.Length; i++)
            {
                if (flag.HasFlag(componentIds[i]))
                {
                    continue;
                }
                flag.SetFlag(componentIds[i]);
            }
            return(MatchGetGroup(flag));
        }
예제 #4
0
파일: Group.cs 프로젝트: zhejimanyu/TSFrame
 public bool HasComponent(Int32 flag)
 {
     return(ComponentFlag.HasFlag(flag));
 }