Exemplo n.º 1
0
    public void ContinueWorkout()
    {
        if (WeighingSlider.value == 1)
        {
            TR.cycle = 5;
        }
        else
        {
            TR.cycle = 0;
        }

        TR.replace();
        Target.SetActive(true);

        if (WeighingSlider.value == 2)     // both arms at same time selected
        {
            TR2.cycle = 0;
            TR2.replace();
            Target2.SetActive(true);
        }


        StopLoggingRestTime();
        StartLoggingWorkoutTime();
        GameControl.instance.completedSets++;

        ToContinue();

        /*
         * if (continued == false)
         * {
         *  ToContinue();
         * }
         */
    }
Exemplo n.º 2
0
    //Continues the game (new set) and destroys the point markers
    public void ToContinue()
    {
        GameObject[] gos;
        gos = GameObject.FindGameObjectsWithTag("point");
        foreach (GameObject go in gos)
        {
            Destroy(go);
        }
        continued = true;

        Target.SetActive(true);
        TR.cycle = 0;
        //TR.replace();

        if (WeighingSlider.value == 2)
        {
            Target2.SetActive(true);
            TR2.cycle = 0;
            //TR2.replace();
        }

        // Align cycles for new set
        if (GameControl.instance.completedSets > 1)
        {
            TR.cycle = TR2.cycle = 1;
        }
    }
Exemplo n.º 3
0
    //private LeapServiceProvider provider;

    void Start()
    {
        collisionEvents = new List <ParticleCollisionEvent> ();

        BCI2000.receiveThread = new Thread(() => BCI2000.receiveData(BCI2000.receivePort));
        BCI2000.receiveThread.IsBackground = true;
        BCI2000.receiveThread.Start();
        Target1.SetActive(false);
        Target2.SetActive(false);

        Target     = new GameObject[3];
        Target [1] = Target1;
        Target [2] = Target2;
    }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        // Sound
        SoundManager.instance.ToggleSoundOnorOff();

        ScoreValue.text = "Score: " + scoreAmount.ToString();
        ROMLAmount.text = (ROMLSlider.value * 5.0f).ToString() + "°";
        ROMRAmount.text = (ROMRSlider.value * 5.0f).ToString() + "°";
        //RepsAmount.text = (int)(RepsSlider.value / 3) + " full reps + " + (RepsSlider.value % 3);
        RepsAmount.text         = (int)(RepsSlider.value / 1) + " puck saves (i.e. reps)";
        SetsAmount.text         = SetsSlider.value.ToString();
        RecoveryTimeAmount.text = RecoveryTimeSlider.value.ToString() + " seconds";
        WeighingAmount.text     = WeighingSlider.value.ToString();


        // Save Slider values
        PlayerPrefs.SetFloat("ROMLSlider", ROMLSlider.value);
        PlayerPrefs.SetFloat("ROMRSlider", ROMRSlider.value);
        PlayerPrefs.SetFloat("RepsSlider", RepsSlider.value);
        PlayerPrefs.SetFloat("SetsSlider", SetsSlider.value);
        PlayerPrefs.SetFloat("RecoveryTimeSlider", RecoveryTimeSlider.value);
        PlayerPrefs.SetFloat("WeighingSlider", WeighingSlider.value);
        PlayerPrefs.SetFloat("MaxTimeToTargetSlider", MaxTimeToTargetSlider.value);

        if (SoundToggle.isOn == true)
        {
            PlayerPrefs.SetInt("SoundToggleValue", 1);
        }
        else
        {
            PlayerPrefs.SetInt("SoundToggleValue", 0);
        }

        if (MapToFullROM.isOn == true)
        {
            PlayerPrefs.SetInt("MapToFullROM", 1);
        }
        else
        {
            PlayerPrefs.SetInt("MapToFullROM", 0);
        }



        if (MaxTimeToTargetSlider.value < 20.0f)
        {
            MaxTimeToTargetAmount.fontSize = 16;
            MaxTimeToTargetAmount.text     = MaxTimeToTargetSlider.value.ToString();
        }
        else
        {
            MaxTimeToTargetAmount.fontSize = 24;
            MaxTimeToTargetAmount.text     = "∞";
        }

        // End panel appears
        if ((scoreAmount) >= RepsSlider.value && setAmount == (SetsSlider.value - 1))
        {
            StopLoggingWorkoutTime();

            SoundManager.instance.PlaySingle(GameControl.instance.buzzerAudio, 0.8f);

            EndPanel.SetActive(true);
            EndPanelText.text = "Congratulations!\nMatch practice ís complete for today!";

            // Update statistics
            totalSaves                 = totalSaves + scoreAmount;
            goalsSavedEndText.text     = totalSaves.ToString();
            shotsOnGoalEndText.text    = shotsOnGoal.ToString();
            savePercentage             = 100.0f * (float)totalSaves / (float)shotsOnGoal;
            savePercentageEndText.text = savePercentage.ToString("F0") + " %";

            Target.SetActive(false);

            if (WeighingSlider.value == 2)
            {
                Target2.SetActive(false);
            }

            /*
             * if (PlayerPrefs.GetInt("2PuckShooter") == 1)
             *  Target2.SetActive(false);
             */

            scoreAmount = 0;
            setAmount   = 0;
        }

        // Break panel appears if reps are max and it wasn't the last set
        if ((scoreAmount) >= RepsSlider.value && setAmount != SetsSlider.value)
        {
            StopLoggingWorkoutTime();
            StartLoggingRestTime();

            SoundManager.instance.PlaySingle(GameControl.instance.buzzerAudio, 0.8f);

            breakTimeAmount = RecoveryTimeSlider.value;
            setAmount++;
            BreakPanel.SetActive(true);

            Target.SetActive(false);
            if (WeighingSlider.value == 2)
            {
                Target2.SetActive(false);
            }

            /*
             * if (PlayerPrefs.GetInt("2PuckShooter") == 1)
             *  Target2.SetActive(false);
             */

            continued = false;
            StartCoroutine(BreakTimer());
            scoreAmount = 0;
        }

        if (WeighingSlider.value == -1)
        {
            WeighingAmount.text = "Left arm ONLY";
        }
        if (WeighingSlider.value == 1)
        {
            WeighingAmount.text = "Right arm ONLY";
        }
        if (WeighingSlider.value == 0)
        {
            WeighingAmount.text = "Both arms (1 arm at a time)";
        }
        if (WeighingSlider.value == 2)
        {
            WeighingAmount.text = "Both arms (at same time)";

            /*
             * ROMRSlider.interactable = false;
             * ROMRAmount.text = "";
             *
             * Color titlecolor = ROMRTitle.color;
             * titlecolor.a = 0.20f;
             * ROMRTitle.color = titlecolor;
             */
        }



        //GameControl.instance.completedRepsLeft = scoreRight;            // Note: Arms are mirrored
        //GameControl.instance.completedRepsRight = scoreLeft;
    }