Exemplo n.º 1
0
    // Update is called once per frame
    void LateUpdate()
    {
        // Since we have no button, we use up arrow key to simulate
        if ((fd.ButtonDown() || Input.GetKeyDown(KeyCode.UpArrow)) && grounded && !Input.GetMouseButtonDown(0))
        {
            jump = true;

            grounded = false;
            SoundControl.playJumpSound();
        }
    }
Exemplo n.º 2
0
        void HandleInput(GameTime gameTime)
        {
            fizzyoButtonPressed = false;
            if (fizzyo.ButtonDown())
            {
                //Do Something with the Button
                fizzyoButtonPressed = true;
            }
            var pressureReading = fizzyo.Pressure(); // Get the current Pressure value

            GoodBreath = breathRecogniser.AddSample(gameTime.ElapsedGameTime.Milliseconds, pressureReading);
            if (!breathRecogniser.IsExhaling)
            {
                GoodBreath = breathRecogniser.isLastBreathGood;
            }
            pressurevalue = pressureReading;
        }
Exemplo n.º 3
0
    // Update is called once per frame
    void LateUpdate()
    {
        // Since we have no button, we use up arrow key to simulate
        if ((fd.ButtonDown() || Input.GetKeyDown(KeyCode.Space)) && grounded && canJump && !Input.GetMouseButtonDown(0))
        {
            jump = true;

            grounded = false;
            SoundControl.playJumpSound();

            powerBar.fillAmount = 0f;
        }

        if (breathing)
        {
            powerBar.fillAmount += FizzyoFramework.Instance.Device.Pressure()
                                   / FizzyoFramework.Instance.Recogniser.MaxBreathLength
                                   * Time.deltaTime;
        }
    }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (focused)
        {
            // Either press enter or the device button to submit
            if ((Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return) || fd.ButtonDown()) && !Input.GetMouseButtonDown(0) && name.text.Trim() != "")
            {
                OnSubmit();
            }
        }
        else
        {
            name.ActivateInputField();
            name.text = name.text.Trim();
        }

        // Check if last chance has been used
        if (!lastChanceTaken)
        {
            // Ensure that breath is the best quality
            if (BreathRecogniser.topQualityBreath)
            {
                BadBreathText.alpha0();
                HealthControl.lives += 1;
                Transform   Egg  = GameObject.Find("Egg").transform;
                Rigidbody2D rb2d = Egg.GetComponent <Rigidbody2D>();
                rb2d.constraints = RigidbodyConstraints2D.None;
                rb2d.constraints = RigidbodyConstraints2D.FreezeRotation;
                HealthControl.lifeSpriteArr[0].SetActive(true);

                Egg.position = new Vector3(OnCollision.lastCollidedPlatform.position.x, OnCollision.lastCollidedPlatform.position.y + 1.5f, OnCollision.lastCollidedPlatform.position.z);
                OnCollision.lastCollidedPlatform.gameObject.GetComponent <EdgeCollider2D>().enabled = true;
                Egg.parent = OnCollision.lastCollidedPlatform.gameObject.transform;

                GameOverMenu.gameIsOver = false;

                lastChanceTaken        = true;
                orText.enabled         = false;
                lastChanceText.enabled = false;
            }
        }
    }