public async Task <ICharacter> LoadAsync(IGame game) { _game = game; IGameFactory factory = game.Factory; AGSLoadImageConfig loadConfig = new AGSLoadImageConfig(new AGS.API.Point(0, 0)); IOutfit outfit = await factory.Outfit.LoadOutfitFromFoldersAsync(_baseFolder, walkLeftFolder : "Walk/left", walkDownFolder : "Walk/down", walkRightFolder : "Walk/right", walkUpFolder : "Walk/up", idleLeftFolder : "Idle/left", idleDownFolder : "Idle/down", idleRightFolder : "Idle/right", idleUpFolder : "Idle/up", speakLeftFolder : "Talk/left", speakDownFolder : "Talk/down", speakRightFolder : "Talk/right", speakUpFolder : "Talk/up", loadConfig : loadConfig); _character = factory.Object.GetCharacter("Beman", outfit).Remember(_game, character => { _character = character; subscribeEvents(); }); _character.SpeechConfig.TextConfig = AGSTextConfig.ChangeColor(_character.SpeechConfig.TextConfig, Colors.CornflowerBlue, Colors.Black, 1f); _character.SpeechConfig.TextOffset = new PointF(0f, -10f); //Uncomment for portrait /* * var portrait = game.Factory.Object.GetObject("BemanPortrait"); * portrait.StartAnimation(game.Factory.Graphics.LoadAnimationFromFolder(_baseFolder + "Talk/down")); * portrait.Border = AGSBorders.SolidColor(Colors.AliceBlue, 3f, true); * portrait.Visible = false; * portrait.RenderLayer = AGSLayers.Speech; * portrait.IgnoreViewport = true; * portrait.IgnoreScalingArea = true; * game.State.UI.Add(portrait); * _character.SpeechConfig.PortraitConfig = new AGSPortraitConfig { Portrait = portrait, Positioning = PortraitPositioning.Alternating }; */ var speakAnimation = _character.Outfit[AGSOutfit.Speak]; Characters.RandomAnimationDelay(speakAnimation.Left); Characters.RandomAnimationDelay(speakAnimation.Right); Characters.RandomAnimationDelay(speakAnimation.Down); Characters.RandomAnimationDelay(speakAnimation.Up); _character.StartAnimation(_character.Outfit[AGSOutfit.Idle].Down); _character.Hotspot = "Beman"; _character.PixelPerfect(true); Characters.Beman = _character; _dialogs.Load(game); return(_character); }
public async Task <ICharacter> LoadAsync(IGame game) { AGSLoadImageConfig loadConfig = new AGSLoadImageConfig(new AGS.API.Point(0, 0)); var footstep = await game.Factory.Sound.LoadAudioClipAsync("../../Assets/Sounds/151238__owlstorm__hard-female-footstep-2.wav"); ISoundEmitter emitter = new AGSSoundEmitter(game); emitter.AudioClip = footstep; IOutfit outfit = await game.Factory.Outfit.LoadOutfitFromFoldersAsync(_baseFolder, walkLeftFolder : "Walk/left", walkDownFolder : "Walk/front", idleLeftFolder : "Idle/left", idleDownFolder : "Idle/front", speakLeftFolder : "Talk", loadConfig : loadConfig); _character = game.Factory.Object.GetCharacter("Cris", outfit).Remember(game, c => _character = c); _character.SpeechConfig.TextConfig = AGSTextConfig.ChangeColor(_character.SpeechConfig.TextConfig, Colors.OrangeRed, Colors.Black, 1f); var approach = _character.AddComponent <IApproachComponent>(); approach.ApproachStyle.ApproachWhenVerb["Talk"] = ApproachHotspots.WalkIfHaveWalkPoint; emitter.Object = _character; //Uncomment for portrait /* * var portrait = game.Factory.Object.GetObject("CrisPortrait"); * portrait.StartAnimation(game.Factory.Graphics.LoadAnimationFromFolder(_baseFolder + "Talk")); * portrait.Border = AGSBorders.SolidColor(Colors.AliceBlue, 3f, true); * portrait.Visible = false; * portrait.RenderLayer = AGSLayers.Speech; * portrait.IgnoreViewport = true; * portrait.IgnoreScalingArea = true; * game.State.UI.Add(portrait); * _character.SpeechConfig.PortraitConfig = new AGSPortraitConfig { Portrait = portrait, Positioning = PortraitPositioning.Alternating }; */ var speakAnimation = _character.Outfit[AGSOutfit.Speak]; Characters.RandomAnimationDelay(speakAnimation.Left); Characters.RandomAnimationDelay(speakAnimation.Right); emitter.Assign(_character.Outfit[AGSOutfit.Walk], 1, 5); _character.StartAnimation(_character.Outfit[AGSOutfit.Idle].Down); _character.DisplayName = "Cris"; _character.IsPixelPerfect = true; Characters.Cris = _character; return(_character); }
public async Task <IRoom> LoadAsync(IGame game) { _game = game; _game.Events.OnSavedGameLoad.Subscribe(onSavedGameLoaded); _player = game.State.Player; IGameFactory factory = game.Factory; _room = factory.Room.GetRoom("Broken Curb Street", 20f, 310f, 190f, 10f); //todo: temporary removed loading the flac file as it crashes on windows after migrating to dotnet standard //_room.MusicOnLoad = await factory.Sound.LoadAudioClipAsync("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; var device = AGSGame.Device; await factory.Room.GetAreaAsync(_baseFolder + "walkable1.png", _room, isWalkable : true); await factory.Room.GetAreaAsync(_baseFolder + "walkable2.png", _room, isWalkable : true); await factory.Room.GetAreaAsync(_baseFolder + "walkable3.png", _room, isWalkable : true); await factory.Room.GetAreaAsync(_baseFolder + "walkable4.png", _room, isWalkable : true); _room.Areas[1].Enabled = false; factory.Room.CreateScaleArea(_room.Areas[0], 0.50f, 0.90f); factory.Room.CreateScaleArea(_room.Areas[2], 0.40f, 0.50f); factory.Room.CreateScaleArea(_room.Areas[3], 1.20f, 1.20f); await factory.Room.GetAreaAsync(_baseFolder + "walkbehind1.png", _room, isWalkBehind : true); await factory.Room.GetAreaAsync(_baseFolder + "walkbehind2.png", _room, isWalkBehind : true); IObject wallHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "wallHotspot.png", "Wall", _room); IObject graffitiHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "graffitiHotspot.png", "Graffiti", _room); IObject doorHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "doorHotspot.png", "Door", _room); doorHotspot.Z = wallHotspot.Z - 1; graffitiHotspot.Z = wallHotspot.Z - 1; IObject manholeHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "manholeHotspot.png", "Manhole", _room); IObject roadHotspot = await factory.Object.GetHotspotAsync(_baseFolder + "roadHotspot.png", "Road", _room); roadHotspot.Z = 100f; manholeHotspot.Z = roadHotspot.Z - 1; await factory.Object.GetHotspotAsync(_baseFolder + "barrierHotspot.png", "Barrier", _room); await factory.Object.GetHotspotAsync(_baseFolder + "bloodySidewalkHotspot.png", "Bloody Sidewalk", _room); await factory.Object.GetHotspotAsync(_baseFolder + "brokenCurbHotspot.png", "Broken Curb", _room); await factory.Object.GetHotspotAsync(_baseFolder + "curbHotspot.png", "Curb", _room); await factory.Object.GetHotspotAsync(_baseFolder + "sidewalkHotspot.png", "Sidewalk", _room); await factory.Object.GetHotspotAsync(_baseFolder + "slimeHotspot.png", "Slime", _room); IObject panel = factory.Object.GetAdventureObject("Panel", _room); panel.DisplayName = "Panel"; IAnimation panelAnimation = await factory.Graphics.LoadAnimationFromFolderAsync(_baseFolder + "Panel"); Characters.RandomAnimationDelay(panelAnimation); panel.StartAnimation(panelAnimation); panel.Position = (195, 145, 110); panel.GetComponent <IHotspotComponent>().Interactions.OnInteract(AGSInteractions.INTERACT).Subscribe(_ => panel.Animation.State.IsPaused = !panel.Animation.State.IsPaused); 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); //todo: temporary removed loading the flac file as it crashes on windows after migrating to dotnet standard //_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; var device = AGSGame.Device; AGSMaskLoader maskLoader = new AGSMaskLoader(factory, new ResourceLoader(device.FileSystem, device.Assemblies), device.BitmapLoader); _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); }