public override void Move() { if (Visable) { base.Move(); } if (Intersects(target)) { HasHit = true; onHit.Invoke(); } else if (transform.Position.X < 0 || transform.Position.X > GameUIController.WindowWidth) { HasHit = true; onHit.Invoke(); } }
private async static void CreateScreenAsync(Screen newScreen, EventArg onSwitchScreen) { await Task.Run(() => newScreen.CreateUI()); //Await the creation of the UI to finish. if (CurrentScreen != null) { //Properly destroy the previous screen. CurrentScreen.DestroyScreen(); } CurrentScreen = newScreen; if (onSwitchScreen != null) { onSwitchScreen.Invoke(); } }