using System; using System.Collections.Generic; using System.Linq; using Duality; using Duality.Input; using Duality.Components.Physics; using Duality.Components; using Duality.Resources; namespace FlapOrDie.Controllers { [RequiredComponent(typeof(Camera))] public class MainMenuController : Component, ICmpUpdatable { public ContentRef GameScene { get; set; } void ICmpUpdatable.OnUpdate() { if (DualityApp.Keyboard.KeyHit(Key.Escape)) { DualityApp.Terminate(); } if (DualityApp.Keyboard.KeyHit(Key.Space)) { //preloading materials and sounds foreach (ContentRef m in ContentProvider.GetAvailableContent()) { m.MakeAvailable(); } foreach (ContentRef s in ContentProvider.GetAvailableContent()) { s.MakeAvailable(); } GameScene.Res.FindComponent().Reset(); Scene.SwitchTo(GameScene); } } } }