Beispiel #1
0
    void Update()
    {
        CheckSelected();

        if (!actionReady)
        {
            if (timer < actionDelay)
            {
                timer += Time.deltaTime;
            }
            else
            {
                actionReady = true;
            }
        }
        else
        {
            timer = 0f;
        }

        //Mouse


        float directX = ControllerManager.GetAxis(ControllerInputWrapper.Axis.LeftStickX, 1, true);
        float directY = ControllerManager.GetAxis(ControllerInputWrapper.Axis.LeftStickY, 1, true);

        switch (currentType)
        {
        case ActionType.Play:


            if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 1, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 2, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 3, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 4, true) &&
                !scrollPanel.isPlaying)
            {
                selectAS.Stop();
                selectAS.Play();
                WhiteOut();
            }
            if (directX < -0.05f || directY < -0.05f && actionReady && !scrollPanel.isPlaying)
            {
                scrollAS.Stop();
                scrollAS.Play();
                currentType = ActionType.Credits;
                actionReady = false;
            }
            break;

        case ActionType.Credits:
            if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 1, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 2, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 3, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 4, true) &&
                !scrollPanel.isPlaying)
            {
                selectAS.Stop();
                selectAS.Play();
                creditsPanel.SetActive(true);
                scrollPanel.isPlaying = true;
            }
            if (directX > 0.05f || directY < -0.05f && actionReady && !scrollPanel.isPlaying)
            {
                scrollAS.Stop();
                scrollAS.Play();
                currentType = ActionType.Quit;
                actionReady = false;
            }
            if (directY > 0.05f && actionReady && !scrollPanel.isPlaying)
            {
                scrollAS.Stop();
                scrollAS.Play();
                currentType = ActionType.Play;
                actionReady = false;
            }
            break;

        case ActionType.Quit:
            if (ControllerManager.GetButtonAll(ControllerInputWrapper.Buttons.A, true))
            {
                selectAS.Stop();
                selectAS.Play();
                Application.Quit();
            }
            if (directX < -0.05f || directY > 0.05f && actionReady && !scrollPanel.isPlaying)
            {
                scrollAS.Stop();
                scrollAS.Play();
                currentType = ActionType.Credits;
                actionReady = false;
            }
            break;
        }
    }