Beispiel #1
0
 private void RecordReactionTime(bool leftSamurai, int time)
 {
     if (leftSamurai)
     {
         LeftSamurai.RecordReactionTime(time);
     }
     else
     {
         RightSamurai.RecordReactionTime(time);
     }
 }
Beispiel #2
0
    // Initialization
    void Awake()
    {
        // Get UI manager
        GUI = GetComponent <UIManager>();

        // Get match limit from net manager
        winLimit = BushidoNetManager.Get().MatchLimit;

        LeftSamurai.SetManager(this);
        RightSamurai.SetManager(this);

        // Set event listeners
        EventManager.GameStart += BeginRound;
        EventManager.GameReset += ResetGame;

        Get().StartCoroutine(WaitAndStartRound());
    }
Beispiel #3
0
    // Signal that a player's input was too early
    // - leftSamurai: A boolean representing which player triggered this event
    private void TriggerStrike(bool leftSamurai)
    {
        // Set the round result following the strike
        leftPlayerCausedResult = leftSamurai;

        // Halt input and register early reaction
        waitingForInput = false;
        playerStrike    = true;

        AudioManager.Get().PlayStrikeSound();

        // Signal player strike to system
        EventManager.TriggerGameStrike();

        // Check if either player exceeds the strike limit (strikes out)
        if (LeftSamurai.StrikeOut(strikeLimit, RightSamurai))
        {
            // Change the result to be a win
            // Left player struck out, right player gets a win
            leftPlayerCausedResult = false;

            // Show resulting winner after a delay
            Get().StartCoroutine(WaitAndShowResult(false, true));
            //Get().StartCoroutine(WaitAndShowWinner());
        }
        else if (RightSamurai.StrikeOut(strikeLimit, LeftSamurai))
        {
            // Change the result to be a win
            // Right player struck out, left player gets a win
            leftPlayerCausedResult = true;

            // Show resulting winner after a delay
            Get().StartCoroutine(WaitAndShowResult(false, true));
            //Get().StartCoroutine(WaitAndShowWinner());
        }
        else
        {
            // Neither player struck out, just reset round
            Get().StartCoroutine(WaitAndRestartGame());
        }
    }
Beispiel #4
0
 // Checks if either player has enough wins to claim the match
 private bool MatchWon()
 {
     return(LeftSamurai.GetWinCount() > winLimit / 2 ||
            RightSamurai.GetWinCount() > winLimit / 2);
 }