Beispiel #1
0
 public void EnterMenu()
 {
     ResetMenu();
     _previousState = CharacterState.Control_State;
     CharacterState.SetControlState(CHARACTER_CONTROL_STATE.MENU_NO_MOVEMENT);
     _menu.SetActive(true);
 }
Beispiel #2
0
 //This should probably be replaced with a central class which controlls what window should be shown?
 void Update()
 {
     if (Input.GetButtonDown(InputKeyWords.CANCEL))
     {
         if (CharacterState.Control_State != CHARACTER_CONTROL_STATE.MENU)
         {
             _previousState = CharacterState.Control_State;
             CharacterState.SetControlState(CHARACTER_CONTROL_STATE.MENU);
             _menu.SetActive(true);
         }
         else if (_menu.activeSelf)
         {//If menu object is active, turn it off and set characterState to previousState
             ExitMenu();
         }
     }
 }
Beispiel #3
0
    public void SetMouseState(CHARACTER_CONTROL_STATE state)
    {
        switch (state)
        {
        case CHARACTER_CONTROL_STATE.PLAYERCONTROLLED:
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
            break;

        case CHARACTER_CONTROL_STATE.MENU:
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;
            break;

        case CHARACTER_CONTROL_STATE.CUTSCENE:
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
            break;

        case CHARACTER_CONTROL_STATE.MENU_NO_MOVEMENT:
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;
            break;

        case CHARACTER_CONTROL_STATE.Dev:
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = false;
            break;


        default:
            Debug.Log("CharacterControlState does not have mouse switch case defined, defaulting to menu case");
            SetMouseState(CHARACTER_CONTROL_STATE.MENU);
            break;
        }
    }