Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Pulsar4X.ECSLib.EntityChangeListnerDB"/> class.
        /// </summary>
        /// <param name="factionEntity">will listen for any entites added or removed that are owned by this entity</param>
        public EntityChangeListner(EntityManager manager, Entity factionEntity, List <int> datablobFilter) : base(manager)
        {
            ListenForFaction         = factionEntity;
            _ownerDB                 = ListenForFaction.GetDataBlob <FactionOwnerDB>();
            IncludeDBTypeIndexFilter = datablobFilter;

            bool include = false;

            foreach (var entityitem in manager.GetEntitiesByFaction(ListenForFaction.Guid))
            {
                foreach (var item in IncludeDBTypeIndexFilter)
                {
                    if (entityitem.HasDataBlob(item))
                    {
                        include = true;
                    }
                    else
                    {
                        include = false;
                        break;
                    }
                }
                if (include)
                {
                    ListningToEntites.Add(entityitem);
                }
            }
        }
        void CreateFactionInfo(EntityManager manager, Entity faction)
        {
            List <Entity> entitesWithOrbits  = new List <Entity>(manager.GetAllEntitiesWithDataBlob <OrbitDB>());
            List <Entity> entitiesWithOwners = new List <Entity>(manager.GetEntitiesByFaction(faction.Guid));

            FactionSystemKnowledge factionKen = new FactionSystemKnowledge();

            factionKen.OwnedEntites.AddRange(entitiesWithOwners);
        }
Пример #3
0
        void UpdateTargetList(Entity faction, EntityManager manager)
        {
            var ownedEntites = manager.GetEntitiesByFaction(faction.Guid);

            foreach (var entityItem in ownedEntites)//entity.Manager.GetAllEntitiesWithDataBlob<PositionDB>())
            {
                if (entityItem.HasDataBlob <PositionDB>() && entityItem.HasDataBlob <NameDB>())
                {
                    TargetList.Add(entityItem.Guid, entityItem.GetDataBlob <NameDB>().GetName(faction.Guid));
                    _targetDict.Add(entityItem.Guid, entityItem);
                }
            }
        }
Пример #4
0
 public List <Entity> GetEntitiesForSystem(EntityManager system)
 {
     return(new List <Entity>(system.GetEntitiesByFaction(FactionEntity.Guid)));
 }