Exemplo n.º 1
0
        private IEnumerator Death()
        {
            var sm = Services.GetService <SceneManager>();

            Services.GetService <RenderingManager>().Layers.Where(l => l.Name != "Player").ToList().ForEach(l => l.Show = false);
            var e = new Entity();

            e.Transform.Position = Entity.Transform.Position + new Vector2(0, 200);
            e.AddComponent(new SpriteTextRenderer("GenericFont")
            {
                Text   = $"You have died.\n{_gs.Player.ReasonForDeath}\nPress [Enter] to play again...",
                Layer  = "Player",
                Center = true,
            });
            sm.ActiveScene.AddEntity(e);
            yield return(WaitYieldInstruction.Create(500));

            while (!Input.GetControl <Button>(Controls.Continue).IsDown())
            {
                yield return(null);
            }
            sm.Load(typeof(RoomScene), GameplayState.Create());
        }