Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (GamepadManager.GetKeyDown(PlayerIndex.One, GamepadButton.BACK))
     {
         canvas.enabled = !canvas.enabled;
     }
 }
Esempio n. 2
0
        public static bool MenuUp()
        {
            if (
                GamepadManager.GetKeyDown(PlayerIndex.One, GamepadDpadButton.UP)// ||
                //GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y > +ANALOG_DEADZONE ||
                //GamePad.GetState(PlayerIndex.One).ThumbSticks.Right.Y > +ANALOG_DEADZONE
                )
            {
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
        public static bool MenuLeft()
        {
            if (
                GamepadManager.GetKeyDown(PlayerIndex.One, GamepadDpadButton.LEFT) ||
                GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X < -ANALOG_DEADZONE ||
                GamePad.GetState(PlayerIndex.One).ThumbSticks.Right.X < -ANALOG_DEADZONE
                )
            {
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
 public static bool ResetOrientation()
 {
     return(GamepadManager.GetKeyDown(PlayerIndex.One, GamepadButton.A));
 }
Esempio n. 5
0
 public static bool ResetLevel()
 {
     return(GamepadManager.GetKeyDown(PlayerIndex.One, GamepadButton.Y));
 }
Esempio n. 6
0
 public static bool Dead()
 {
     return(GamepadManager.GetKeyDown(PlayerIndex.One, GamepadButton.BACK) || Input.GetKeyDown(KeyCode.Backspace));
 }
Esempio n. 7
0
 public static bool Pause()
 {
     return(GamepadManager.GetKeyDown(PlayerIndex.One, GamepadButton.START) || Input.GetKeyDown(KeyCode.Return));
 }
Esempio n. 8
0
 public static bool PauseNextPage()
 {
     return(GamepadManager.GetKeyDown(PlayerIndex.One, GamepadButton.RIGHTSHOULDER));
 }
Esempio n. 9
0
 public static bool PausePreviousPage()
 {
     return(GamepadManager.GetKeyDown(PlayerIndex.One, GamepadButton.LEFTSHOULDER));
 }
Esempio n. 10
0
    // Update is called once per frame
    void Update()
    {
        if (GamepadManager.GetKeyDown(PlayerIndex.One, GamepadButton.LEFTSHOULDER))
        {
            timeActive = !timeActive;

            if (timeActive)
            {
                text.color = _timerColorOn;
            }
            else
            {
                text.color = _timerColorPaused;
            }
        }

        if (GamepadManager.GetKeyDown(PlayerIndex.One, GamepadButton.RIGHTSHOULDER))
        {
            timeActive = false;
            time       = 0.0f;
            text.color = _timerColorZero;
        }

        //if(GamepadManager.GetKey(PlayerIndex.One, GamepadButton.RIGHTSHOULDER) &&
        //    GamepadManager.GetKey(PlayerIndex.One, GamepadButton.LEFTSHOULDER))
        //{
        //    time = 0.0f;
        //    //timeActive = false;
        //    text.color = _timerColorZero;
        //}


        if (timeActive)
        {
            time += Time.deltaTime;
        }

        float msec    = Mathf.Floor((time * 100) % 100); // * 1000.0f;
        float seconds = Mathf.Floor(time % 60);
        float minutes = Mathf.Floor((time / 60) % 60);
        float hours   = Mathf.Floor((time / 3600) % 60);

        string milliStr;
        string secondsStr;
        string minutesStr;
        string hoursStr;

        string blinkingColon = ":";
        string blinkingDot   = ".";

        if (msec > 50)
        {
            blinkingColon = " ";
            blinkingDot   = " ";
        }


        hoursStr   = DoubleDigitConvert(hours);
        minutesStr = DoubleDigitConvert(minutes);
        secondsStr = DoubleDigitConvert(seconds);
        milliStr   = DoubleDigitConvert(msec);

        string frameNumber = DoubleDigitConvert((Time.time - Mathf.Floor(Time.time)) * 30.0f);

        //string str = string.Format("{00}", hoursStr);

        //text.text = string.Format("{00}", (int)time) + blinkingDot +
        //    string.Format("{00}", (int)(Mathf.Repeat(time, 1.0f) * 100));

        text.text =
            //string.Format("{00}", hoursStr) + blinkingColon +
            string.Format("{00}", minutesStr) + blinkingColon +
            string.Format("{00}", secondsStr) + blinkingDot +
            string.Format("{00}", milliStr)
            + string.Format("  [{00}]", frameNumber);
    }