protected virtual StaticEntities GetStaticEntities(int espaceId)
        {
            var staticEntities = new StaticEntities();

            using (Transaction systemTransaction = DatabaseAccess.ForSystemDatabase.GetReadOnlyTransaction()) {
                using (IDataReader reader = DBRuntimePlatform.Instance.GetStaticRecordsByEspaceId(systemTransaction, espaceId)) {
                    while (reader.Read())
                    {
                        // "SELECT DATA_ID, NAME, SS_KEY, ENTITY_SS_KEY " ...
                        var dataId    = reader.SafeGet <string>("DATA_ID");
                        var ssKey     = reader.SafeGet <string>("SS_KEY");
                        var entityKey = reader.SafeGet <string>("ENTITY_SS_KEY");

                        Records records;
                        // Doing this way because java fails to translate otherwise
                        if (!staticEntities.ContainsKey(entityKey))
                        {
                            records = new Records();
                            staticEntities.Add(entityKey, records);
                        }
                        else
                        {
                            records = staticEntities[entityKey];
                        }

                        records.Add(ssKey, dataId);
                    }
                }
            }

            return(staticEntities);
        }
Example #2
0
        public StaticEntity GetStaticEntityAtPosition(int x, int y)
        {
            if (!IsInBounds(x, y))
            {
                return(EDGE_WALL_ENTITY);
            }

            var position = new IntVector2(x, y);

            if (StaticEntities.Contains(position))
            {
                return(StaticEntities[position]);
            }

            return(null);
        }
Example #3
0
        public IEnumerable <Entity> GetEntitiesAtPosition(int x, int y)
        {
            if (!IsInBounds(x, y))
            {
                return(null);
            }

            var position = new IntVector2(x, y);
            var entities = new List <Entity>();

            if (StaticEntities.Contains(position))
            {
                entities.Add(StaticEntities[position]);
            }
            entities.AddRange(DynamicEntities.Where(e => e.Position == position));
            entities.AddRange(PlayerEntities.Where(e => e.Position == position));
            return(entities);
        }
 public ModuleDetails(StaticEntities staticEntities)
 {
     this.StaticEntities = staticEntities;
 }
 public ModuleDefinition()
 {
     this.Screens        = new Screens();
     this.StaticEntities = new StaticEntities();
 }