Beispiel #1
0
    /// <summary>
    /// Called by BalloonObstacleScript when a collision occurs, used to help determine stars/score
    /// for the level as recording some aspects of the smart feedback data
    /// </summary>
    /// <param name="obstacle">The position of the obstacle that was hit</param>
    /// <param name="playerParam">The position of the player at the time of the collision</param>
    public void RecordCollision(Vector2 obstacle, Vector2 playerParam, bool cloud)
    {
        int hand;

        if (currentStage < 3)
        {
            hand = _GlobalVariables.LEFT_INDEX;
            currentStageLeftCollisions += 1;
        }
        else
        {
            hand = _GlobalVariables.RIGHT_INDEX;
            currentStageRightCollisions += 1;
        }

        if (cloud)
        {
            BalloonSmartFeedback.Collision(hand, BalloonSmartFeedback.CLOUD_COLLISION);
        }
        else
        {
            if (playerParam.x < obstacle.x)
            {
                BalloonSmartFeedback.Collision(hand, BalloonSmartFeedback.LEFT_COLLISION);
            }
            else
            {
                BalloonSmartFeedback.Collision(hand, BalloonSmartFeedback.RIGHT_COLLISION);
            }
        }
    }
Beispiel #2
0
    /// <summary>
    /// Called once the stages have all been used and it is time to display
    /// final level statistics
    /// </summary>
    private void TriggerGameOver()
    {
        Time.timeScale = 0;
        gameOverScript.SetStars(GetNumStars());

        string graphCol1   = "leftMaxStrength";
        string graphCol2   = "rightMaxStrength";
        string graphTitle1 = "Maximum Strength With Left Hand Per Session";
        string graphTitle2 = "Maximum Strength With Right Hand Per Session";
        string tableCol1   = "leftCollisions";
        string tableCol2   = "rightCollisions";

        int[] leftStages             = { 0, 1, 2 };
        int[] rightStages            = { 3, 4, 5 };
        IGameSessionData[] dataArray = dataList.ToArray();

        StringData[] tables =
        {
            new StringData(dataArray.LooseRange(0, 3), tableCol1, format: "0"),
            new StringData(dataArray.LooseRange(3, 3), tableCol2, format: "0", offset: 3)
        };

        dataDisplay.AddTableView(tables);
        dataDisplay.AddTextView(BalloonSmartFeedback.LevelFinish());
        dataDisplay.AddGraph(_GlobalVariables.dataRep.GetSessionData(TABLE_NAME,
                                                                     DATA_POINTS), graphCol1, discludeStages: rightStages, title: graphTitle1, difficulty: _GlobalVariables.difficulty);
        dataDisplay.AddGraph(_GlobalVariables.dataRep.GetSessionData(TABLE_NAME,
                                                                     DATA_POINTS), graphCol2, discludeStages: leftStages, title: graphTitle2, difficulty: _GlobalVariables.difficulty);

        gameOverScript.gameObject.SetActive(true);

        Debug.Log("Balloon game controller, GOS Active: " + gameOverScript.gameObject.activeSelf);

        dataDisplay.InitializeDisplays();
    }
Beispiel #3
0
 /// <summary>
 /// Called when the game object is being destroyed, used for signaling to the
 /// arduino communicator thread that the system could potentially shut down soon
 /// </summary>
 void OnDestroy()
 {  //do not keep leftovers; reset variables every time game is left
     _GlobalVariables.mainThreadActive = false;
     BalloonSmartFeedback.ResetVars();
 }