protected override async Task <IRoom> loadAsync() { IGameFactory f = _game.Factory; _room = f.Room.GetRoom(ROOM_ID); PointF[] parallaxVals = new PointF[6] { new PointF(0f, 0f), new PointF(0.15f, 0.2f), new PointF(0.1f, 0.1f), new PointF(0.3f, 0.4f), new PointF(1f, 1f), new PointF(2.4f, 2.2f) }; Point[] coordVals = new Point[6] { new Point(-200, 20), new Point(-320, 250), new Point(-320, 100), new Point(-240, -50), new Point(0, -55), new Point(400, -120) }; _backgroundLayers = new IRenderLayer[4]; for (int i = 0, z = AGSLayers.Background.Z - 1; i < 4; ++i, --z) { _backgroundLayers[i] = new AGSRenderLayer(z, parallaxVals[i]); IObject o = await addTerra($"layer{i}", $"parallax_l{i + 1}.png", coordVals[i].X, coordVals[i].Y); o.RenderLayer = _backgroundLayers[i]; } IObject foreground = await addTerra("foreground", "parallax_l5.png", coordVals[4].X, coordVals[4].Y); _foregroundLayers = new IRenderLayer[1]; for (int i = 5, l = 0, z = AGSLayers.Foreground.Z - 1; i < 6; ++i, --z) { _foregroundLayers[l] = new AGSRenderLayer(z, parallaxVals[i]); IObject o = await addTerra($"layer{i}", $"parallax_l{i + 1}.png", coordVals[i].X, coordVals[i].Y); o.RenderLayer = _foregroundLayers[l]; } int ry = _game.Settings.VirtualResolution.Height; _roomBounds = new RectangleF(foreground.X, foreground.Y, foreground.Width, ry - foreground.Y); _room.RoomLimitsProvider = AGSRoomLimits.Custom(_roomBounds); return(_room); }
private async Task addLampPosts(IGameFactory factory) { PointF parallaxSpeed = new PointF(1.4f, 1f); AGSRenderLayer parallaxLayer = new AGSRenderLayer(-50, parallaxSpeed); var image = await factory.Graphics.LoadImageAsync(_baseFolder + "lampPost.png"); var singleFrame = new AGSSingleFrameAnimation(image, factory.Graphics); const int numLampPosts = 3; for (int index = 0; index < numLampPosts; index++) { IObject lampPost = factory.Object.GetObject("Lamp Post " + index); lampPost.X = 200f * index + 30f; lampPost.Y = -130f; lampPost.RenderLayer = parallaxLayer; lampPost.StartAnimation(singleFrame); _room.Objects.Add(lampPost); } }
private async Task addLampPosts(IGameFactory factory) { PointF parallaxSpeed = (1.4f, 1f); AGSRenderLayer parallaxLayer = new AGSRenderLayer(-50, parallaxSpeed); var image = await factory.Graphics.LoadImageAsync(_baseFolder + "lampPost.png"); const int numLampPosts = 3; for (int index = 0; index < numLampPosts; index++) { IObject lampPost = factory.Object.GetAdventureObject("Lamp Post " + index, _room); lampPost.DisplayName = "Lamp Post"; lampPost.IsPixelPerfect = true; lampPost.X = 200f * index + 30f; lampPost.Y = -130f; lampPost.RenderLayer = parallaxLayer; lampPost.Image = image; } }
public FeaturesTopWindow(RotatingCursorScheme scheme) { _scheme = scheme; _layer = new AGSRenderLayer(AGSLayers.UI.Z, independentResolution: (1200, 800)); _panels = new Dictionary <string, Lazy <IFeaturesPanel> >(); }