Exemple #1
0
    /// <summary>
    /// Signalling that the game has ended, and the winner of the game.
    /// </summary>
    /// <param name="winner"></param>
    public void GameOver(PlayersEnum winner)
    {
        // update the game winner
        _winner = winner;

        // print the collected data points to debug console
        Debug.Log($"{Enum.GetName(typeof(PlayersEnum), _winner)} won, sending telemetry data...");
        Debug.Log((
                      $"Player 1 used {_playerOneProjectiles} projectile(s); Player 2 used {_playerTwoProjectiles} projectile(s)."));
        Debug.Log(
            $"Player 1 has {_playerOneTargets} target(s) surviving; Player 2 has {_playerTwoTargets} target(s) surviving.");

        // upload the collected data points
        var result = UploadData();

        Debug.Log($"Telemetry submission result: {result.ToString()}");
    }
Exemple #2
0
    /// <summary>
    /// Enable the slingshot for a given player.
    /// </summary>
    /// <param name="player">The player to enable the slingshot for.</param>
    public void EnableSlingshotForPlayer(PlayersEnum player)
    {
        switch (player)
        {
        case PlayersEnum.PlayerOne:
            if (GameObject.FindWithTag("SlingshotP1"))
            {
                GameObject.FindWithTag("SlingshotP1").SendMessage("EnableSlingshotReloading");
            }
            return;

        case PlayersEnum.PlayerTwo:
            if (GameObject.FindWithTag("SlingshotP2"))
            {
                GameObject.FindWithTag("SlingshotP2").SendMessage("EnableSlingshotReloading");
            }
            return;

        default:
            return;
        }
    }
 // activate the winning screen upon a player winning
 private static void Win(PlayersEnum player, string playerName)
 {
     GameObject.Find("Telemetry").SendMessage("GameOver", player);
     GameObject.FindWithTag("gameOver").GetComponent <Canvas>().enabled = true;
     GameObject.FindWithTag("winMessage").GetComponent <Text>().text    = $"{playerName} Won!";
 }