Beispiel #1
0
        protected virtual async Task <FloorTileSide> GetFloorSide(Point point, ITile tile)
        {
            var tileData = builder.CurrentMap[point.X, point.Y];

            var topleft     = tileData.GrabableItems.Where(x => x.TilePosition == TilePosition.North_TopLeft).Select(x => SetupItem(x, tile));
            var topRight    = tileData.GrabableItems.Where(x => x.TilePosition == TilePosition.East_TopRight).Select(x => SetupItem(x, tile));
            var bottomLeft  = tileData.GrabableItems.Where(x => x.TilePosition == TilePosition.South_BottomLeft).Select(x => SetupItem(x, tile));
            var bottomRifgh = tileData.GrabableItems.Where(x => x.TilePosition == TilePosition.West_BottomRight).Select(x => SetupItem(x, tile));

            var       floorTile = tileData as FloorTileData;
            Texture2D texture   = null;

            if (floorTile != null)
            {
                texture = floorTile.RandomDecoration != null ? builder.FloorTextures[floorTile.RandomDecoration.Value] : null;
            }

            if (!tileData.Actuators.Any())
            {
                var floor = new FloorTileSide(texture != null, MapDirection.Down, topleft, topRight, bottomLeft, bottomRifgh);
                floor.Renderer = builder.Factories.RenderersSource.GetFloorRenderer(floor, builder.WallTexture, texture);
                return(floor);
            }
            else
            {
                var floor = new ActuatorFloorTileSide(await floorCreator.GetFloorActuator(tileData.Actuators), texture != null, MapDirection.Down, topleft, topRight, bottomLeft, bottomRifgh);
                floor.Renderer = builder.Factories.RenderersSource.GetActuatorFloorRenderer(floor, builder.WallTexture, texture);
                return(floor);
            }
        }
 public virtual IRenderer GetActuatorFloorRenderer(ActuatorFloorTileSide floor, Texture2D wallTexture, Texture2D texture)
 {
     return(new ActuatorFloorTileSideRenderer(floor, wallTexture, texture));
 }