protected virtual async Task <TileSide> CreateWallSide(MapDirection wallDirection, WallTileData wall, Point pos) { ActuatorItemData[] sensorsData; if (wall != null) { sensorsData = wall.Actuators.Where(a => a.TilePosition == wallDirection.Opposite.ToTilePosition()).ToArray(); } else { sensorsData = new ActuatorItemData[0]; } TextDataItem textData = wall?.TextTags.FirstOrDefault(x => x.TilePosition == wallDirection.Opposite.ToTilePosition()); int?randomTexture; if (!sensorsData.Any() && AllowedRandomDecoration(wallDirection, wall, out randomTexture)) { sensorsData = new[] { new ActuatorItemData { ActuatorType = 0, IsLocal = true, Decoration = randomTexture.Value + 1 } } } ; if (textData != null) { var res = new TextTileSide(wallDirection, textData.IsVisible, textData.Text); res.Renderer = builder.Factories.RenderersSource.GetTextSideRenderer(res, builder.WallTexture); return(res); } else if (!sensorsData.Any()) { var res = new TileSide(wallDirection); res.Renderer = builder.Factories.RenderersSource.GetWallSideRenderer(res, builder.WallTexture); return(res); } else { var items = wall.GrabableItems .Select(builder.ItemCreator.CreateItem) .ToList(); var res = new ActuatorWallTileSide(await wallCreator.ParseActuatorX(sensorsData, items, pos), wallDirection); res.Renderer = builder.Factories.RenderersSource.GetActuatorWallSideRenderer(res, builder.WallTexture); return(res); } }
public virtual IRenderer GetActuatorWallSideRenderer(ActuatorWallTileSide side, Texture2D wallTexture) { return(new ActuatorSideRenderer(side, wallTexture)); }