public static void Talk(Entity obj) { tempData.Add("UpArrow", "true"); GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("Ziggy", "I can't believe you figured it out!", obj.Position + new Vector2(0, -84)), new MessageBox("Ziggy", ".|.|. Well done!", obj.Position + new Vector2(0, -84)) }, true, () => { GameGlobal.PlayerController.MovementEnabled = false; Entity temp = Entity.Find("EarthRock"); CameraController.Instance.Shake(3); Global.AudioController.Play("SFX/EarthRockRumble"); StaticCoroutines.CoroutineHelper.RunOverX(3, 64, t => { temp.Position += new Vector2(0, 1f); }, () => { obj.Destroy(); GameData.Set("EarthRock/First", "2"); temp.Destroy(); GameGlobal.PlayerController.MovementEnabled = true; }); } ); }
public static void First(Entity obj) { if (GameData.Get("EarthRock/First") != null) { obj.Destroy(); return; } GameData.Set("EarthRock/First", "1"); GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("", "!", obj.Position + new Vector2(0, -64)), new MessageBox("Ziggy", "Hi.|.|.", obj.Position + new Vector2(0, -64)), new MessageBox("Ziggy", "I didn't think you'd survived.|.|.\nYou fell into that tree almost 3 days ago...", obj.Position + new Vector2(0, -64)), new MessageBox("Ziggy", "I'm not sure what this means but I feel implelled\nto tell you that if you want to interact with\nsomething you can press UP!", obj.Position + new Vector2(0, -64)), new MessageBox("Ziggy", "Why don't you try it on me!", obj.Position + new Vector2(16, -32)) }, true, () => { // Input icons if (GameData.Get("Tips/UpToInteract") == null) { GameData.Set("Tips/UpToInteract", "1"); Texture2D texture2D = GameMethods.GetInputIcon(InputManager.Input.Up, Global.InputManager.CurrentInputType); GameMethods.DisplayInputIcon(texture2D, new Vector2(119 * 16 + 8, 57 * 16 + 2), () => { return(false); }); GameMethods.DisplayInputIcon(texture2D, Entity.Find("EarthRock").Position + new Vector2(-8, 32 + 2), () => { return(tempData.ContainsKey("UpArrow")); }); } } ); }
public static void ID_first(Entity obj) { if (GameData.Get("NPCChest/" + obj.Data["id"] + "/" + "script") == null) { Global.AudioController.Play("SFX/OpenChest"); obj.GetComponent <Sprite>().RunAnimation("Opening", false); GameData.Set("NPCChest/" + obj.Data["id"] + "/" + "open", "true"); GameGlobal.PlayerController.MovementMode = PlayerController.MovementModes.None; StaticCoroutines.CoroutineHelper.WaitRun(1, () => { GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox(null, "There's nothing inside.|.|.", new Vector2(obj.Position.X, obj.Position.Y - 30)) }, null, () => { StaticCoroutines.CoroutineHelper.WaitRun(2, () => { GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("Majestic Chest", "Hi!|| Did you want something?", new Vector2(obj.Position.X, obj.Position.Y - 30)), new MessageBox("Pause", "|.|.|.| I wasn't expecting that.", new Vector2(GameGlobal.Player.Position.X, GameGlobal.Player.Position.Y - 20)) }, null, () => { StaticCoroutines.CoroutineHelper.WaitRun(1, () => { GameGlobal.PlayerController.MovementMode = PlayerController.MovementModes.Normal; GameData.Set("NPCChest/" + obj.Data["id"] + "/" + "open", "false"); GameData.Set("NPCChest/" + obj.Data["id"] + "/" + "script", "2"); obj.GetComponent <Sprite>().RunAnimation("Closing", false); Global.AudioController.Play("SFX/OpenChest"); }); }); }); }); }); } else if (GameData.Get("NPCChest/" + obj.Data["id"] + "/" + "script") == "2") { GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox(null, ".|.|. nothing.", new Vector2(obj.Position.X, obj.Position.Y - 30)) }, true, () => { }); } }
public static void End(Entity obj) { GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("", "Oh, this is as far as you go...|", obj.Position + new Vector2(0, -32)), new MessageBox("", "An adventure awaits you on the\nother side of this cave!|", obj.Position + new Vector2(0, -32)) }, true, () => { GameGlobal.Player.GetComponent <PlayerController>().MovementEnabled = false; StaticCoroutines.CoroutineHelper.RunUntil(() => { return(Global.AudioController.MasterVolume <= 0); }, () => { Global.AudioController.MasterVolume -= 0.15f * Global.DeltaTime; }, () => { MonoXEngineGame.Instance.Exit(); }); GameGlobal.Fader.Data["Time"] = "4"; GameGlobal.Fader.RunFunction("FadeOut", entity => { entity.RunFunction("SetDefault"); }); } ); }
public void Save(Vector2 pos) { Saving = true; GameGlobal.PlayerController.MovementEnabled = false; if (GameData.Get("SavePoint/First") == null) { GameData.Set("SavePoint/First", "1"); GameMethods.ShowMessages(new List <MessageBox> { new MessageBox("", "Something is written here.|.|.", pos), new MessageBox("It say's", "'If you touch this grave stone your entire life up to\nthis point will be recorded.\n\nThe Holy Gravestone'|", pos), new MessageBox("Holy Gravestone", "Why don't they just call it a save point?", pos) }, null, () => { Save(pos); }); } else { MessageBox messageBox = new MessageBox(null, "Would you like to save?", pos); messageBox.Build(null, () => { GameMethods.ShowOptionSelector(pos + new Vector2(-16, 16), new List <Option>() { new Option("yes", "Yes", new Vector2(0, 0)), new Option("no", "No", new Vector2(0, 16)) }, option => { if (option == "yes") { Global.AudioController.Play("SFX/Save"); GameData.Save(); } messageBox.Destroy(); GameGlobal.PlayerController.MovementEnabled = true; Saving = false; }); }); } }
public void TheTree() { SoundEffectInstance forestAmbienceSFX = Global.AudioController.Play("SFX/Forest_Ambience"); forestAmbienceSFX.Volume = 0.3f; CoroutineHelper.Always(() => { if (forestAmbienceSFX.State == SoundState.Stopped) { forestAmbienceSFX = Global.AudioController.Play("SFX/Forest_Ambience"); forestAmbienceSFX.Volume = 0.3f; } }); Global.SceneManager.CurrentScene.OnExit += () => { Global.AudioController.Stop("SFX/Forest_Ambience"); }; if (GameData.Get("Levels/TheTree/Intro") == "True") { // Music Global.AudioController.PlayMusic("Overworld Happy"); return; } MyGame.Scenes.Level.CameraController.Offset = new Vector2(16, 0); // Initial fade GameGlobal.Fader.RunFunction("BlackOut"); GameGlobal.Fader.RunFunction("Cancel"); GameGlobal.Fader.Data["Time"] = "5"; CoroutineHelper.WaitRun(2, () => { GameGlobal.Fader.RunFunction("Resume"); GameGlobal.Fader.RunFunction("FadeIn"); }); GameGlobal.PlayerController.MovementEnabled = false; GameGlobal.PlayerController.Kinetic = true; GameGlobal.PlayerGraphic.Visible = false; GameGlobal.PlayerController.MovementMode = PlayerController.MovementModes.None; // Camera pan down Entity camePos = new Entity(e => { e.Position = GameGlobal.Player.Position + new Vector2(0, -800); }); CameraController.Instance.Easing = 0.03f; CameraController.Instance.MaxStep = 1f; CameraController.Instance.Target = camePos; CameraController.Instance.SnapOnce(); // Seagulls CoroutineHelper.WaitRun(11, () => { CoroutineHelper.WaitRun(1, () => { Global.AudioController.Play("SFX/BushRustle"); }); new Entity(entity => { entity.LayerName = "Main"; entity.SortingLayer = 8; entity.AddComponent(new Sprite() { Texture2D = Global.Content.Load <Texture2D>("Entities/Seagull") }).Run <Sprite>(s => { s.AddAnimation(new Animation("Default", 0.1f, new Point(16, 16), new Point(0, 0), new Point(1, 0), new Point(2, 0), new Point(3, 0), new Point(3, 0), new Point(3, 0))); s.RunAnimation("Default"); }); entity.Position = GameGlobal.Player.Position + new Vector2(0, -100); entity.Scale = new Vector2(2.1f, 2.1f); CoroutineHelper.RunUntil(() => { return(entity.Position.Y < -500); }, () => { entity.Position += new Vector2(0.3f, -0.2f * entity.Scale.Y); entity.Scale += new Vector2(-0.003f, -0.003f); if (entity.Scale.X < 0.5f) { entity.Scale = new Vector2(0.5f, 0.5f); } }); }); new Entity(entity => { entity.LayerName = "Main"; entity.SortingLayer = 8; entity.AddComponent(new Sprite() { Texture2D = Global.Content.Load <Texture2D>("Entities/Seagull") }).Run <Sprite>(s => { s.AddAnimation(new Animation("Default", 0.1f, new Point(16, 16), new Point(0, 0), new Point(1, 0), new Point(2, 0), new Point(3, 0), new Point(3, 0), new Point(3, 0))); s.RunAnimation("Default"); }); entity.Position = GameGlobal.Player.Position + new Vector2(-40, -100); entity.Scale = new Vector2(2, 2); CoroutineHelper.RunUntil(() => { return(entity.Position.Y < -500); }, () => { entity.Position += new Vector2(0.3f, -0.2f * entity.Scale.Y); entity.Scale += new Vector2(-0.003f, -0.003f); if (entity.Scale.X < 0.5f) { entity.Scale = new Vector2(0.5f, 0.5f); } }); }); }); CoroutineHelper.WaitRun(7, () => { camePos.Position = GameGlobal.Player.Position + new Vector2(0, -40); CoroutineHelper.WaitRun(12, () => { GameGlobal.Player.Position = camePos.Position + new Vector2(0, -20); GameGlobal.PlayerGraphic.RunAnimation("Jump"); GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("Pause", ".|.|.|| !", camePos.Position), new MessageBox("Pause", "Huh|.|.|.||| I don't remember\nsleeping there!?", camePos.Position) }, null, () => { CoroutineHelper.WaitRun(3, () => { GameGlobal.PlayerGraphic.Visible = true; MessageBox WoahMSG = new MessageBox("Pause", "Woah!", camePos.Position, MessageBox.Type.ManualDestroy); WoahMSG.Build(); float temp = GameGlobal.Player.Position.Y; CoroutineHelper.RunFor(0.7f, p => { if (GameGlobal.Player.Position.Y < camePos.Position.Y + 45) { GameGlobal.Player.Position.Y += 1f * (p * 4.15f); } if (GameGlobal.Player.Position.Y > WoahMSG.Position.Y + 32) { WoahMSG.Position = GameGlobal.Player.Position + new Vector2(-WoahMSG.Container.Size.X / 2, -32); } }, () => { GameGlobal.Player.Position.Y = camePos.Position.Y + 45; GameGlobal.PlayerGraphic.RunAnimation("Lay"); Global.AudioController.Play("SFX/Thump"); WoahMSG.Destroy(); GameMethods.SmokePuffs(8, GameGlobal.PlayerGraphicEntity.Position, new Point(8, 8)); CameraController.Instance.Shake(0.7f); CoroutineHelper.WaitRun(2, () => { // Music Global.AudioController.PlayMusic("Overworld Happy", 1); GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("Pause", "OUCH!", GameGlobal.Player.Position + new Vector2(0, -32)), }, null, () => { GameGlobal.PlayerController.MovementEnabled = true; GameGlobal.PlayerController.MovementMode = PlayerController.MovementModes.Normal; GameGlobal.PlayerController.Kinetic = false; CameraController.Instance.Easing = 0.1f; CameraController.Instance.MaxStep = 1000; CameraController.Instance.Target = GameGlobal.Player; camePos.Destroy(); GameGlobal.PlayerGraphic.RunAnimation("Stand"); GameGlobal.PlayerController.Direction = 1; GameGlobal.PlayerController.IsGrounded = true; GameData.Set("Levels/TheTree/Intro", "True"); GameGlobal.Fader.RunFunction("SetDefault"); }); }); }); }); }); }); }); }