Exemple #1
0
    public void OnUpdate()
    {
        float upVal   = Math.Max(Input.GetTriggered(0, "up"), Input.GetTriggered(0, "arrowUp"));
        float downVal = Math.Max(Math.Abs(Input.GetTriggered(0, "down")), Input.GetTriggered(0, "arrowDown"));

        // supports xbox controller's analogue mapping and keyboard binary inputs
        if (upVal > 0.0f)
        {
            if (item_ == 0)
            {
                item_ = (int)Items.I_TOTAL - 1;
            }
            else
            {
                item_--;
            }
        }
        else if (downVal > 0.0f || upVal < 0.0f)
        {
            if (item_ == (int)Items.I_TOTAL - 1)
            {
                item_ = 0;
            }
            else
            {
                item_++;
            }
        }
        else if (Input.GetTriggered(0, "Exit") > 0.0f || Input.GetTriggered(0, "MenuBack") > 0.0f)
        {
            Engine.getInstance().SetPauseMode(false);
            Map.UnloadMap();
        }
        else if (Input.GetTriggered(0, "MenuSelect") > 0.0f)
        {
            switch (item_)
            {
            case (int)Items.I_RESUME:
                Engine.getInstance().SetPauseMode(false);
                Map.UnloadMap();
                break;

            case (int)Items.I_HOWTOPLAY:
                Map.LoadMapDontUnload("Assets/Levels/howToPlay_Stealth.mocha");
                break;

            case (int)Items.I_OPTIONS:
                break;

            case (int)Items.I_MAINMENU:
                Map.LoadMapDontUnload("Assets/Levels/pauseMenu_MainMenu.mocha");
                break;

            case (int)Items.I_QUIT:
                Map.LoadMapDontUnload("Assets/Levels/pauseMenu_Quit.mocha");
                break;
            }
        }
        trans_.SetPosition(itemPos_[item_].X, itemPos_[item_].Y, 0.1f);
    }
Exemple #2
0
    public void OnUpdate()
    {
        float upVal   = Math.Max(Input.GetTriggered(0, "up"), Input.GetTriggered(0, "arrowUp"));
        float downVal = Math.Max(Math.Abs(Input.GetTriggered(0, "down")), Input.GetTriggered(0, "arrowDown"));

        // supports xbox controller's analogue mapping and keyboard binary inputs
        if (upVal > 0.0f)
        {
            if (item_ == 0)
            {
                item_ = (int)Items.I_TOTAL - 1;
            }
            else
            {
                item_--;
            }
        }
        else if (downVal > 0.0f || upVal < 0.0f)
        {
            if (item_ == (int)Items.I_TOTAL - 1)
            {
                item_ = 0;
            }
            else
            {
                item_++;
            }
        }
        else if (Input.GetTriggered(0, "MenuSelect") > 0.0f)
        {
            switch (item_)
            {
            case (int)Items.I_START:
                Map.LoadOnlyMap("Assets/Levels/Episode1_5.mocha");
                break;

            case (int)Items.I_HOWTOPLAY:
                Map.LoadMapDontUnload("Assets/Levels/howToPlay_Stealth.mocha");
                break;

            case (int)Items.I_OPTIONS:
                break;

            case (int)Items.I_CREDITS:
                Map.LoadMapDontUnload("Assets/Levels/credits.mocha");
                break;

            case (int)Items.I_QUIT:
                Map.LoadMapDontUnload("Assets/Levels/mainMenu_Quit.mocha");
                break;
            }
        }
        trans_.SetPosition(itemPos_[item_].X, itemPos_[item_].Y, 0.1f);
    }
    public void OnUpdate()
    {
        float upVal    = Math.Max(Input.GetTriggered(0, "up"), Input.GetTriggered(0, "arrowUp"));
        float downVal  = Math.Max(Math.Abs(Input.GetTriggered(0, "down")), Input.GetTriggered(0, "arrowDown"));
        float leftVal  = Math.Max(Math.Abs(Input.GetTriggered(0, "left")), Input.GetTriggered(0, "arrowLeft"));
        float rightVal = Math.Max(Input.GetTriggered(0, "right"), Input.GetTriggered(0, "arrowRight"));

        // supports xbox controller's analogue mapping and keyboard binary inputs
        if (upVal > 0.0f || rightVal > 0.0f)
        {
            if (item_ == 0)
            {
                item_ = (int)Items.I_TOTAL - 1;
            }
            else
            {
                item_--;
            }
        }
        else if (downVal > 0.0f || upVal < 0.0f || leftVal > 0.0f || rightVal < 0.0f)
        {
            if (item_ == (int)Items.I_TOTAL - 1)
            {
                item_ = 0;
            }
            else
            {
                item_++;
            }
        }
        else if (Input.GetTriggered(0, "MenuSelect") > 0.0f)
        {
            switch (item_)
            {
            case (int)Items.I_YES:
                Engine.getInstance().Exit();
                break;

            case (int)Items.I_NO:
                Map.UnloadMap();
                break;
            }
        }
        else if (Input.GetTriggered(0, "Exit") > 0.0f || Input.GetTriggered(0, "MenuBack") > 0.0f)
        {
            Map.UnloadMap();
        }
        trans_.SetPosition(itemPos_[item_].X, itemPos_[item_].Y, 0.1f);
    }
Exemple #4
0
    public void OnUpdate()
    {
        float upVal   = Math.Max(Input.GetTriggered(0, "up"), Input.GetTriggered(0, "arrowUp"));
        float downVal = Math.Max(Math.Abs(Input.GetTriggered(0, "down")), Input.GetTriggered(0, "arrowDown"));

        // supports xbox controller's analogue mapping and keyboard binary inputs
        if (upVal > 0.0f)
        {
            if (item_ == 0)
            {
                item_ = (int)Items.I_TOTAL - 1;
            }
            else
            {
                item_--;
            }
        }
        else if (downVal > 0.0f || upVal < 0.0f)
        {
            if (item_ == (int)Items.I_TOTAL - 1)
            {
                item_ = 0;
            }
            else
            {
                item_++;
            }
        }
        else if (Input.GetTriggered(0, "MenuSelect") > 0.0f)
        {
            switch (item_)
            {
            case (int)Items.I_YES:
                Engine.getInstance().SetPauseMode(false);
                // Sound.StopAllAudio();
                Map.LoadOnlyMap("Assets/Levels/mainMenu.mocha");
                break;

            case (int)Items.I_NO:
                Map.UnloadMap();
                break;
            }
        }
        else if (Input.GetTriggered(0, "Exit") > 0.0f || Input.GetTriggered(0, "MenuBack") > 0.0f)
        {
            Map.UnloadMap();
        }
        trans_.SetPosition(itemPos_[item_].X, itemPos_[item_].Y, 0.1f);
    }