예제 #1
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here    
     currentState = StateMachine.Instance;
     currentState.state = StateMachine.ScreenState.GAME_MENU;
     StateMachine.Instance.resWidth = graphics.GraphicsDevice.Viewport.Width;
     StateMachine.Instance.resHeight = graphics.GraphicsDevice.Viewport.Height;
     leapController = new Controller();
     listener = new SingleListener();
     leapController.EnableGesture(Gesture.GestureType.TYPE_CIRCLE);
     leapController.EnableGesture(Gesture.GestureType.TYPESCREENTAP);
     leapController.AddListener(listener);
     base.Initialize();
 }
예제 #2
0
 public void changeState(StateMachine.ScreenState state)
 {
     switch (state)
     {
         case StateMachine.ScreenState.GAME_MENU:
             if(currentState.state == StateMachine.ScreenState.MENU_RH)
                 Components.Remove(gs_RecognizeHuruf);
             if (currentState.state == StateMachine.ScreenState.MENU_RM)
                 Components.Remove(gs_RecognizeMnist);
             if (currentState.state == StateMachine.ScreenState.MENU_RM200)
                 Components.Remove(gs_RecognizeMnist200);
             if (currentState.state == StateMachine.ScreenState.MENU_ADDDATA)
                 Components.Remove(gs_AddData);
             Components.Clear();   
             currentState.state = StateMachine.ScreenState.GAME_MENU;
             Components.Add(gs_StartScreen);
             break;
         case StateMachine.ScreenState.MENU_ADDDATA:
             if(currentState.state == StateMachine.ScreenState.GAME_MENU)
                 Components.Remove(gs_StartScreen);
             Components.Clear();   
             Components.Add(gs_AddData);
             currentState.state = StateMachine.ScreenState.MENU_ADDDATA;
             break;
         case StateMachine.ScreenState.MENU_RM:
             if (currentState.state == StateMachine.ScreenState.GAME_MENU)
                 Components.Remove(gs_StartScreen);
             Components.Clear();
             Components.Add(gs_RecognizeMnist);
             currentState.state = StateMachine.ScreenState.MENU_RM;
             break;
         case StateMachine.ScreenState.MENU_RH:
             if (currentState.state == StateMachine.ScreenState.GAME_MENU)
                 Components.Remove(gs_StartScreen);
             Components.Clear();
             Components.Add(gs_RecognizeHuruf);
             currentState.state = StateMachine.ScreenState.MENU_RH;
             break;
         case StateMachine.ScreenState.MENU_RM200:
             if (currentState.state == StateMachine.ScreenState.GAME_MENU)
                 Components.Remove(gs_StartScreen);
             Components.Clear();
             Components.Add(gs_RecognizeMnist200);
             currentState.state = StateMachine.ScreenState.MENU_RM200;
             break;
         case StateMachine.ScreenState.EXIT_GAME:
             Exit();
             break;
     }
 }