示例#1
0
    /*----------------------------------------------*/
    //Transitions Tiles dependent on exercise state //
    public void transitionTile()
    {
        ExerciseProtocolState state = HIITController.Instance.currentState;

        for (int i = 0; i < sections.Count; i++)
        {
            if (state == ExerciseProtocolState.lowIntensity || state == ExerciseProtocolState.trainingLow)
            {
                sections [i].GetComponent <LevelTile> ().lowIntensityTransition();                 //Transition tiles graphically to low
                if (activeSections.Contains(sections [i].GetComponent <LevelTile> ()))
                {
                    spawnObjectsTile(sections [i].GetComponent <LevelTile> ());
                }
            }
            else if (state == ExerciseProtocolState.highIntensity || state == ExerciseProtocolState.trainingHigh)
            {
                sections [i].GetComponent <LevelTile> ().highIntensityTransition();                 //Transition tiles graphically to high
            }
            else
            {
                spawn = true;
                if (activeSections.Contains(sections [i].GetComponent <LevelTile> ()))
                {
                    spawnObjectsTile(sections [i].GetComponent <LevelTile> ());
                }
            }
        }
    }
示例#2
0
    /*----------------------------------------------------------------------------------------------------------*/
    //Saves the current snapshot of Speed values (Forward/Lateral) appending it with the current exercise state //
    public void saveIntervalSpeed(ExerciseProtocolState state)
    {
        float          avgSpeed    = 0;
        float          avgLatSpeed = 0;
        intervalSpeeds snapshot;
        int            i = 0;

        //Average the speed values for current interval
        for (i = 0; i < currentIntervalSpeeds.Count; i++)
        {
            avgSpeed += currentIntervalSpeeds [i];
        }
        avgSpeed /= currentIntervalSpeeds.Count;

        //Average the lateral speed values
        for (i = 0; i < currentIntervalLateralSpeeds.Count; i++)
        {
            avgLatSpeed += currentIntervalLateralSpeeds [i];
        }
        avgLatSpeed /= currentIntervalLateralSpeeds.Count;

        //Save values to a snapshot
        snapshot.interval            = state;
        snapshot.averageSpeed        = avgSpeed;
        snapshot.averageLateralSpeed = avgLatSpeed;
        snapshot.Speeds        = currentIntervalSpeeds;
        snapshot.lateralSpeeds = currentIntervalLateralSpeeds;
        sessionIntervalSpeeds.Add(snapshot);

        //reset collected speed lists
        currentIntervalSpeeds.Clear();
        currentIntervalLateralSpeeds.Clear();
    }
示例#3
0
    /*------------------------------------------------------------*/
    // Training Intervals -- Repeats high intensity/low intensity // ------------------------------------
    /*------------------------------------------------------------*/

    /*---------------------------------------*/
    //Co routine for training phase exercise //
    IEnumerator trainingL()
    {
        //Loops Low and High Intensity for training until stopped overwise

        yield return(new WaitForSeconds(1.8f));               //wait for transition / clear up of high intensity

        currentState   = ExerciseProtocolState.trainingLow;   //sets the current exercise state to training
        countdownTimer = trainingLowDuration;                 //Sets our countdown timer

        //initiate setup for start of training phase -- tells the game manager to create game objects
        GameManager.Instance.transitionTile();                 //Transition tiles

        //ceases control of the function for the alloted duration of the training phase
        yield return(new WaitForSeconds(trainingLowDuration));

        //finish training phase
        GameManager.Instance.clearGameComponents();  //Clears existing components
        GameManager.Instance.setSpawning(false);     //stops spawning objects

        //saves the period of training speed data
        motionEnhancer.saveIntervalSpeed(ExerciseProtocolState.trainingLow);

        //Transitions to high intensity exercise
        StartCoroutine(trainingH());
    }
示例#4
0
    /*------------------------------------------------------------*/
    // Exercise Intervals -- Repeats high intensity/low intensity // ------------------------------------
    /*------------------------------------------------------------*/


    /*--------------------------------------------*/
    //Co routine for low intensity phase exercise //
    IEnumerator lowIntensity()
    {
        Debug.Log("Low Intensity -- Begin");
        //if the current exercise phase number has not reached the total
        if (intervalNumber > currentIntervals)
        {
            yield return(new WaitForSeconds(1.8f));            //wait for transition / clear up of high intensity

            currentState = ExerciseProtocolState.lowIntensity; //Set current state to low intensity
            currentIntervals++;                                //Increment current Exercise intervals
            countdownTimer = lowIntDuration;                   //Sets our countdown timer

            //initiate setup for start of low intensity phase
            GameManager.Instance.transitionTile();             //Transition tiles

            //gameManager.spawnObjectsRandom(lava,(int)Mathf.Ceil((motionEnhancer.calculateBaseRunningSpeed(1 / 53f)) * multiplierLava), probability, true);
            //gameManager.spawnObjectsRandom(truck, (int)Mathf.Ceil((motionEnhancer.calculateBaseRunningSpeed(1 / 53f)) * multiplierTruck), 1, false);

            //wait for 90 seconds
            yield return(new WaitForSeconds(lowIntDuration));

            //saves the period of low intensity speed data
            motionEnhancer.saveIntervalSpeed(ExerciseProtocolState.lowIntensity);

            //finish low intensity phase
            GameManager.Instance.clearGameComponents();
            GameManager.Instance.setSpawning(false);             //stops spawning objects

            //initiate next exercise phase
            StartCoroutine(highIntensity());
        }
        else
        {
            //Finished exercise
            currentState = ExerciseProtocolState.finish;
            finishCleanup();
        }
    }
示例#5
0
 /*------------------------------------------------------------------------------------*/
 //Adjusts the current state of the chaser (slow moving -- Low  || High speed -- High) //
 public void setState(ExerciseProtocolState newState)
 {
     state = newState;
 }
示例#6
0
    /*--------------------------------------------*/
    //Co routine for High intensity phase exercise //
    IEnumerator highIntensity()
    {
        Debug.Log("High Intensity -- Begin");
        if (intervalNumber > currentIntervals)
        {
            //yield return new WaitForSeconds(1.1f);//waiting for field to clear up
            currentState = ExerciseProtocolState.highIntensity; //Set current exercise state to high intensity
            currentIntervals++;                                 //Increase current intervals
            countdownTimer = highIntDuration;                   //Sets our countdown timer

            //initiate setup for start of high intensity phase
            GameManager.Instance.transitionTile();             //Transition tiles

            //gameManager.spawnObjectsRandom(truck, (int)Mathf.Ceil((motionEnhancer.calculateBaseRunningSpeed(1 / 53f)) * multiplierTruck), 1,false);

            //Spawn appropriate high intensity challenge
            switch (GameManager.Instance.gameCondition)
            {
            case personalityType.Conqueror:
                //Activate the boss lich
                conquerorBoss.transform.position = new Vector3(0, 0, PlayerController.Instance.transform.position.z + 13f);
                conquerorBoss.gameObject.SetActive(true);
                break;

            case personalityType.Survivor:
                //Activates the chaser to begin following the player
                chaseController.setState(ExerciseProtocolState.highIntensity);
                break;

            case personalityType.Mixed:
                //Activate the lich on first HighIntensity then alternate (true = conq / false = surv)
                if (mixedHighFlag)
                {
                    conquerorBoss.transform.position = new Vector3(0, 0, PlayerController.Instance.transform.position.z + 13f);
                    conquerorBoss.gameObject.SetActive(true);
                }
                else
                {
                    chaseController.setState(ExerciseProtocolState.highIntensity);
                }
                break;
            }

            //wait for X seconds
            yield return(new WaitForSeconds(highIntDuration));

            //saves the period of high intensity speed data
            motionEnhancer.saveIntervalSpeed(ExerciseProtocolState.highIntensity);

            //finish high intensity phase -----------------------------------------------------------------------
            switch (GameManager.Instance.gameCondition)
            {
            case personalityType.Conqueror:
                conquerorBoss.HighIntensityEnd();                  //Deactivates lich
                break;

            case personalityType.Survivor:
                chaseController.setState(ExerciseProtocolState.lowIntensity);                 //sets the chaser to low intensity
                break;

            case personalityType.Mixed:
                if (mixedHighFlag)
                {
                    //Deactivates lich
                    conquerorBoss.HighIntensityEnd();
                }
                else
                {
                    //sets the chaser to low intensity
                    chaseController.setState(ExerciseProtocolState.lowIntensity);
                }
                //Alternates which high intensity we will have next
                mixedHighFlag = !mixedHighFlag;
                //increment segment
                GameManager.Instance.incrementMixedSegment();
                break;
            }

            //Enables enemy spawning again
            GameManager.Instance.setSpawning(true);
            //Start Low intensity
            StartCoroutine(lowIntensity());
        }
        else
        {
            currentState = ExerciseProtocolState.finish;
            finishCleanup();
        }
    }
示例#7
0
    /*---------------------------------------*/
    //Co routine for training phase exercise //
    IEnumerator trainingH()
    {
        //yield return new WaitForSeconds(1.1f);//waiting for field to clear up
        currentState   = ExerciseProtocolState.trainingHigh; //Set current exercise state to high intensity
        countdownTimer = trainingHighDuration;               //Sets our countdown timer

        //initiate setup for start of high intensity phase
        GameManager.Instance.transitionTile();         //Transition tiles

        //Spawn appropriate high intensity challenge
        switch (GameManager.Instance.gameCondition)
        {
        case personalityType.Conqueror:
            //Activate the boss lich
            conquerorBoss.transform.position = new Vector3(0, 0, PlayerController.Instance.transform.position.z + 13f);
            conquerorBoss.gameObject.SetActive(true);
            break;

        case personalityType.Survivor:
            //Activates the chaser to begin following the player
            chaseController.setState(ExerciseProtocolState.highIntensity);
            break;

        case personalityType.Mixed:
            //Activate the lich on first HighIntensity then alternate (true = conq / false = surv)
            if (mixedHighFlag)
            {
                conquerorBoss.transform.position = new Vector3(0, 0, PlayerController.Instance.transform.position.z + 13f);
                conquerorBoss.gameObject.SetActive(true);
            }
            else
            {
                chaseController.setState(ExerciseProtocolState.highIntensity);
            }
            break;
        }

        //wait for X seconds
        yield return(new WaitForSeconds(trainingHighDuration));

        //saves the period of high intensity speed data
        motionEnhancer.saveIntervalSpeed(ExerciseProtocolState.trainingHigh);

        //finish high intensity phase -----------------------------------------------------------------------
        switch (GameManager.Instance.gameCondition)
        {
        case personalityType.Conqueror:
            conquerorBoss.HighIntensityEnd();              //Deactivates lich
            break;

        case personalityType.Survivor:
            chaseController.setState(ExerciseProtocolState.lowIntensity);             //sets the chaser to low intensity
            break;

        case personalityType.Mixed:
            if (mixedHighFlag)
            {
                //Deactivates lich
                conquerorBoss.HighIntensityEnd();
            }
            else
            {
                //sets the chaser to low intensity
                chaseController.setState(ExerciseProtocolState.lowIntensity);
            }
            //Alternates which high intensity we will have next
            mixedHighFlag = !mixedHighFlag;
            //If Mixed condition, increment segment
            GameManager.Instance.incrementMixedSegment();
            break;
        }

        //Enables enemy spawning again
        GameManager.Instance.setSpawning(true);

        //Start Low intensity
        StartCoroutine(trainingL());
    }