Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        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();
            }
        }