isOpenable() public static method

public static isOpenable ( ) : bool
return bool
Example #1
0
 private void OnPress(bool isPressed)
 {
     if (isPressed && CraftZoneManager.isOpenable())
     {
         Logger.Log("ToCraftButton::OnPress()", Logger.Level.INFO);
         GUITransitioner.get().GoToScreen(GUITransitioner.GameScreen.screen3);
     }
 }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (isShortcutKeyDown(KeyCode.X))
        {
            Logger.Log("pressed shortcut to teleport Cellia to the pursuit", Logger.Level.INFO);
            CellControl.get().teleport(new Vector3(500, 0, 637));
        }
        else if (isShortcutKeyDown(KeyCode.V))
        {
            Logger.Log("pressed shortcut to teleport Cellia to the GFP BioBrick", Logger.Level.INFO);
            CellControl.get().teleport(new Vector3(168, 0, 724));
        }
        else if (isShortcutKeyDown(KeyCode.W))
        {
            Logger.Log("pressed shortcut to teleport Cellia to the end of the game", Logger.Level.INFO);
            CellControl.get().teleport(new Vector3(-150, 0, 1110));
        }

        switch (_gameState)
        {
        case GameState.Start:

            endWindow.SetActive(false);
            mainMenu.setNewGame();
            if (GameConfiguration.RestartBehavior.GAME == MemoryManager.get().configuration.restartBehavior)
            {
                leaveMainMenu();
            }
            else
            {
                goToMainMenuFrom(GameState.Game);
            }
            break;

        case GameState.MainMenu:
            if (Input.GetKeyUp(KeyCode.UpArrow))
            {
                mainMenu.selectPrevious();
            }
            else if (Input.GetKeyUp(KeyCode.DownArrow))
            {
                mainMenu.selectNext();
            }
            else if (Input.GetKeyUp(KeyCode.Return) || Input.GetKeyUp(KeyCode.KeypadEnter))
            {
                mainMenu.getCurrentItem().click();
            }
            else if (Input.GetKeyDown(KeyCode.Escape))
            {
                mainMenu.escape();
            }
            break;

        case GameState.Game:

            prepareGameLevelIfNecessary();

            //pause
            if (isShortcutKeyDown(_pauseKey))
            {
                Logger.Log("GameStateController::Update - Escape/Pause key pressed", Logger.Level.DEBUG);
                ModalManager.setModal(pauseIndicator, false);
                changeState(GameState.Pause);
            }
            //main menu
            else if (Input.GetKeyDown(KeyCode.Escape))
            {
                goToMainMenuFrom(GameState.Game);
            }
            //inventory
            //TODO add DNA damage accumulation management when player equips/unequips too often
            else if (isShortcutKeyDown(_inventoryKey) && Inventory.isOpenable())
            {
                Logger.Log("GameStateController::Update inventory key pressed", Logger.Level.INFO);
                gUITransitioner.GoToScreen(GUITransitioner.GameScreen.screen2);
            }
            //crafting
            else if (isShortcutKeyDown(_craftingKey) && CraftZoneManager.isOpenable())
            {
                Logger.Log("GameStateController::Update craft key pressed", Logger.Level.INFO);
                gUITransitioner.GoToScreen(GUITransitioner.GameScreen.screen3);
            }

            /*
             * else if(isShortcutKeyDown(_sandboxKey))
             * {
             *  Logger.Log("GameStateController::Update sandbox key pressed from scene="+MemoryManager.get ().configuration.getSceneName(), Logger.Level.INFO);
             *  goToOtherGameMode();
             * }*/
            //TODO fix this feature

            /*
             * else if(isShortcutKeyDown(_forgetDevicesKey))
             * {
             *  Inventory.get ().switchDeviceKnowledge();
             * }*/
            break;

        case GameState.Pause:
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                goToMainMenuFrom(GameState.Pause);
            }
            else
            {
                GameStateTarget newState = ModalManager.manageKeyPresses();
                if (GameStateTarget.NoAction != newState)
                {
                    if (
                        GameStateTarget.NoTarget != newState &&
                        GameStateTarget.Pause != newState
                        )
                    {
                        changeState(getStateFromTarget(newState));
                    }
                }
                else
                {
                    switch (gUITransitioner._currentScreen)
                    {
                    case GUITransitioner.GameScreen.screen1:
                        break;

                    case GUITransitioner.GameScreen.screen2:
                        if (isShortcutKeyDown(_inventoryKey) || Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Return))
                        {
                            Logger.Log("GameStateController::Update out of inventory key pressed", Logger.Level.INFO);
                            gUITransitioner.GoToScreen(GUITransitioner.GameScreen.screen1);
                        }
                        else if (isShortcutKeyDown(_craftingKey) && CraftZoneManager.isOpenable())
                        {
                            Logger.Log("GameStateController::Update inventory to craft key pressed", Logger.Level.INFO);
                            gUITransitioner.GoToScreen(GUITransitioner.GameScreen.screen3);
                        }
                        break;

                    case GUITransitioner.GameScreen.screen3:
                        if (isShortcutKeyDown(_inventoryKey) && Inventory.isOpenable())
                        {
                            Logger.Log("GameStateController::Update craft to inventory key pressed", Logger.Level.INFO);
                            gUITransitioner.GoToScreen(GUITransitioner.GameScreen.screen2);
                        }
                        else if (isShortcutKeyDown(_craftingKey) || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyUp(KeyCode.KeypadEnter))
                        {
                            Logger.Log("GameStateController::Update out of craft key pressed", Logger.Level.INFO);
                            gUITransitioner.GoToScreen(GUITransitioner.GameScreen.screen1);
                        }
                        break;

                    default:
                        Logger.Log("GameStateController::Update unknown screen " + gUITransitioner._currentScreen, Logger.Level.WARN);
                        break;
                    }
                }
            }
            break;

        case GameState.End:
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                goToMainMenuFrom(GameState.End);
            }
            break;

        default:
            break;
        }
    }