public async Task<IRoom> LoadAsync(IGame game) { _game = game; _game.Events.OnSavedGameLoad.Subscribe((sender, e) => onSavedGameLoaded()); _player = _game.State.Player; IGameFactory factory = game.Factory; _room = factory.Room.GetRoom("Dars Street", 20f, 490f, 190f, 10f); IObject bg = factory.Object.GetObject("Dars Street BG"); IAnimation bgAnimation = await factory.Graphics.LoadAnimationFromFolderAsync(_baseFolder + "bg"); bgAnimation.Frames[0].MinDelay = 1; bgAnimation.Frames[0].MaxDelay = 120; bg.StartAnimation(bgAnimation); _room.Background = bg; AGSMaskLoader maskLoader = new AGSMaskLoader (factory, new ResourceLoader()); _room.Areas.Add(AGSWalkableArea.Create("DarsStreetWalkable1", await maskLoader.LoadAsync(_baseFolder + "walkable1.png"))); _room.Areas.Add(AGSWalkableArea.Create("DarsStreetWalkable2", await maskLoader.LoadAsync(_baseFolder + "walkable2.png"))); AGSScalingArea.Create(_room.Areas[0], 0.35f, 0.75f); AGSZoomArea.Create(_room.Areas[0], 1f, 1.2f); AGSScalingArea.Create(_room.Areas[1], 0.10f, 0.35f); AGSZoomArea.Create(_room.Areas[1], 1.2f, 1.8f); _room.Areas.Add(AGSWalkBehindArea.Create("DarsStreetWalkBehind1", await maskLoader.LoadAsync(_baseFolder + "walkbehind1.png"))); _room.Areas.Add(AGSWalkBehindArea.Create("DarsStreetWalkBehind2", await maskLoader.LoadAsync (_baseFolder + "walkbehind2.png"))); _room.Areas.Add(AGSWalkBehindArea.Create("DarsStreetWalkBehind3", await maskLoader.LoadAsync (_baseFolder + "walkbehind3.png"))); IObject buildingHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "buildingHotspot.png", "Building"); IObject doorHotspot = await factory.Object.GetHotspotAsync (_baseFolder + "doorHotspot.png", "Door"); IObject windowHotspot = await factory.Object.GetHotspotAsync (_baseFolder + "windowHotspot.png", "Window"); doorHotspot.Z = buildingHotspot.Z - 1; windowHotspot.Z = buildingHotspot.Z - 1; windowHotspot.Interactions.OnInteract(AGSInteractions.LOOK).SubscribeToAsync(lookOnWindow); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "aztecBuildingHotspot.png", "Aztec Building")); _room.Objects.Add(buildingHotspot); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "carHotspot.png", "Car")); _room.Objects.Add(doorHotspot); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "fencesHotspot.png", "Fences")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "neonSignHotspot.png", "Neon Sign")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "roadHotspot.png", "Road")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "sidewalkHotspot.png", "Sidewalk")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "skylineHotspot.png", "Skyline")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "trashcansHotspot.png", "Trashcans")); _room.Objects.Add(windowHotspot); await addLampPosts(factory); subscribeEvents(); return _room; }
public async Task<IRoom> LoadAsync(IGame game) { _game = game; IGameFactory factory = game.Factory; _bottleEffectClip = await factory.Sound.LoadAudioClipAsync("../../Assets/Sounds/254818__kwahmah-02__rattling-glass-bottles-impact.wav"); ILoadImageConfig loadConfig = new AGSLoadImageConfig(new AGS.API.Point(0, 0)); _room = factory.Room.GetRoom(_roomId, 20f, 310f, 190f, 10f); _room.MusicOnLoad = await factory.Sound.LoadAudioClipAsync("../../Assets/Sounds/AMemoryAway.ogg"); _game.Events.OnSavedGameLoad.Subscribe((sender, e) => onSavedGameLoaded()); IObject bg = factory.Object.GetObject("Empty Street BG"); bg.Image = await factory.Graphics.LoadImageAsync(_baseFolder + "bg.png"); _room.Background = bg; AGSMaskLoader maskLoader = new AGSMaskLoader (factory, new ResourceLoader()); _room.Areas.Add(AGSWalkableArea.Create("EmptyStreetWalkable1", await maskLoader.LoadAsync(_baseFolder + "walkable1.png"))); _room.Areas.Add(AGSWalkableArea.Create("EmptyStreetWalkable2", await maskLoader.LoadAsync (_baseFolder + "walkable2.png"))); AGSScalingArea.Create(_room.Areas[0], 0.50f, 0.75f); AGSScalingArea.Create(_room.Areas[1], 0.75f, 0.90f); IObject bottleHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "BottleHotspot.png", "Bottle"); bottleHotspot.WalkPoint = new AGS.API.PointF (140f, 50f); _room.Objects.Add(await factory.Object.GetHotspotAsync (_baseFolder + "CurbHotspot.png", "Curb")); _room.Objects.Add(bottleHotspot); _room.Objects.Add(await factory.Object.GetHotspotAsync (_baseFolder + "GapHotspot.png", "Gap", new[]{"It's a gap!", "I wonder what's in there!"})); _bottle = factory.Object.GetObject(_bottleId); _bottle.Image = await factory.Graphics.LoadImageAsync(_baseFolder + "bottle.bmp", loadConfig: loadConfig); _bottle.WalkPoint = bottleHotspot.WalkPoint; _bottle.X = 185f; _bottle.Y = 85f; _bottle.Hotspot = "Bottle"; _room.Objects.Add(_bottle); subscribeEvents(); return _room; }
public async Task<IRoom> LoadAsync(IGame game) { _game = game; _player = _game.State.Player; _game.Events.OnSavedGameLoad.Subscribe((sender, e) => onSavedGameLoaded()); IGameFactory factory = game.Factory; _room = factory.Room.GetRoom("Trashcan Street", 20f, 310f, 190f, 10f); IObject bg = factory.Object.GetObject("Trashcan Street BG"); bg.Image = await factory.Graphics.LoadImageAsync(_baseFolder + "bg.png"); _room.Background = bg; AGSMaskLoader maskLoader = new AGSMaskLoader (factory, new ResourceLoader()); _room.Areas.Add(AGSWalkableArea.Create("TrashcanStreetWalkable1", await maskLoader.LoadAsync(_baseFolder + "walkable.png"))); AGSScalingArea.Create(_room.Areas[0], 0.50f, 0.90f); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "HoleHotspot.png", "Hole")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "roadHotspot.png", "Road")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "sidewalkHotspot.png", "Sidewalk")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "SignHotspot.png", "Sign")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "trashCansHotspot.png", "Trashcans")); subscribeEvents(); return _room; }
public async Task<IRoom> LoadAsync(IGame game) { _game = game; _game.Events.OnSavedGameLoad.Subscribe((sender, e) => onSavedGameLoaded()); _player = game.State.Player; IGameFactory factory = game.Factory; _room = factory.Room.GetRoom ("Broken Curb Street", 20f, 310f, 190f, 10f); _room.MusicOnLoad = await factory.Sound.LoadAudioClipAsync("../../Assets/Sounds/01_Ghosts_I.flac"); IObject bg = factory.Object.GetObject("Broken Curb BG"); bg.Image = await factory.Graphics.LoadImageAsync(_baseFolder + "bg.png"); _room.Background = bg; AGSMaskLoader maskLoader = new AGSMaskLoader (factory, new ResourceLoader()); _room.Areas.Add(AGSWalkableArea.Create("BrokenCurbWalkable1", await maskLoader.LoadAsync(_baseFolder + "walkable1.png"))); _room.Areas.Add(AGSWalkableArea.Create("BrokenCurbWalkable2", await maskLoader.LoadAsync(_baseFolder + "walkable2.png"))); _room.Areas.Add(AGSWalkableArea.Create("BrokenCurbWalkable3", await maskLoader.LoadAsync(_baseFolder + "walkable3.png"))); _room.Areas.Add(AGSWalkableArea.Create("BrokenCurbWalkable4", await maskLoader.LoadAsync(_baseFolder + "walkable4.png"))); _room.Areas[1].Enabled = false; AGSScalingArea.Create(_room.Areas[0], 0.50f, 0.90f); AGSScalingArea.Create(_room.Areas[2], 0.40f, 0.50f); AGSScalingArea.Create(_room.Areas[3], 1.20f, 1.20f); _room.Areas.Add(AGSWalkBehindArea.Create("BrokenCurbWalkBehind1", maskLoader.Load(_baseFolder + "walkbehind1.png"))); _room.Areas.Add(AGSWalkBehindArea.Create("BrokenCurbWalkBehind2", maskLoader.Load(_baseFolder + "walkbehind2.png"))); IObject wallHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "wallHotspot.png", "Wall"); IObject graffitiHotspot = await factory.Object.GetHotspotAsync (_baseFolder + "graffitiHotspot.png", "Graffiti"); IObject doorHotspot = await factory.Object.GetHotspotAsync (_baseFolder + "doorHotspot.png", "Door"); doorHotspot.Z = wallHotspot.Z - 1; graffitiHotspot.Z = wallHotspot.Z - 1; IObject manholeHotspot = await factory.Object.GetHotspotAsync (_baseFolder + "manholeHotspot.png", "Manhole"); IObject roadHotspot = await factory.Object.GetHotspotAsync (_baseFolder + "roadHotspot.png", "Road"); manholeHotspot.Z = roadHotspot.Z - 1; _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "barrierHotspot.png", "Barrier")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "bloodySidewalkHotspot.png", "Bloody Sidewalk")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "brokenCurbHotspot.png", "Broken Curb")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "curbHotspot.png", "Curb")); _room.Objects.Add(doorHotspot); _room.Objects.Add(graffitiHotspot); _room.Objects.Add(manholeHotspot); _room.Objects.Add(roadHotspot); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "sidewalkHotspot.png", "Sidewalk")); _room.Objects.Add(await factory.Object.GetHotspotAsync(_baseFolder + "slimeHotspot.png", "Slime")); _room.Objects.Add(wallHotspot); IObject panel = factory.Object.GetObject("Panel"); panel.Hotspot = "Panel"; IAnimation panelAnimation = await factory.Graphics.LoadAnimationFromFolderAsync(_baseFolder + "Panel"); Characters.RandomAnimationDelay(panelAnimation); panel.StartAnimation(panelAnimation); panel.X = 195; panel.Y = 145; panel.Z = 110; panel.Interactions.OnInteract(AGSInteractions.INTERACT).Subscribe((sender, args) => panel.Animation.State.IsPaused = !panel.Animation.State.IsPaused); _room.Objects.Add(panel); subscribeEvents(); return _room; }