コード例 #1
0
        public T?ReadEntity <T>()
            where T : IEntity
        {
            var id = Reader.ReadUInt32();

            return(_entityResolver.EntityById <T>((int)id));
        }
コード例 #2
0
        private LandscapeItem ProcessLocation(int x, int y)
        {
            var mapLoc      = _map.GetAt(new Loc(x, y));
            var terrainInfo = _entityResolver.EntityById <TerrainInfo>((int)mapLoc.Terrain.Raw());

            if (terrainInfo == null)
            {
                return(null);
            }

            var item = new LandscapeItem {
                Loc      = new Loc(x, y),
                Floor    = GetFloorTypeFromTerrain(mapLoc.Terrain),
                Army     = mapLoc.HasArmy && terrainInfo.IsArmyVisible,
                Mist     = mapLoc.IsMisty,
                Position = Vector3.Zero,
                Terrain  = mapLoc.Terrain
            };

            if (!_options.IsMoving && item.Army)
            {
                if (item.Loc == _options.CurrentLocation)
                {
                    item.Army = false;
                }
            }

            // check the current lords army temporarily
            // popping up as we move in or out of a location
            if (_options.IsMoving && item.Army)
            {
                if (item.Loc == _options.MoveFrom ||
                    item.Loc == _options.MoveTo &&
                    !_options.MoveLocationHasArmy)
                {
                    item.Army = false;
                }
            }


            return(CalcCylindricalProjection(item));
        }