public void Start()
    {
        PlayersPerTeam = new Dictionary <Team, List <PhotonPlayer> >();
        Array enumVals = Enum.GetValues(typeof(Team));

        foreach (var enumVal in enumVals)
        {
            PlayersPerTeam[(Team)enumVal] = new List <PhotonPlayer>();
        }

        this.UpdateTeams();

        //We get the playercount
        string players = this.countPlayers();

        string[] playerTab = players.Split(';');

        int blueCount = int.Parse(playerTab[0]);
        int redCount  = int.Parse(playerTab[1]);

        //We get our player
        PhotonView   myView   = PhotonView.Get(this);
        PhotonPlayer myPlayer = myView.owner;

        //We set the team depending on the players
        if (myView.isMine)
        {
            if (blueCount <= redCount)
            {
                TeamExtensions.SetTeam(myPlayer, Team.blue);
            }
            else
            {
                TeamExtensions.SetTeam(myPlayer, Team.red);
            }

            Debug.Log("You are on team " + TeamExtensions.GetTeam(myPlayer));
        }

        //If we are the masterclient we verify the score and if there are none we set it
        if (PhotonNetwork.isMasterClient)
        {
            if (!TeamExtensions.isTeamScoreSet("Blue"))
            {
                TeamExtensions.SetTeamScore("Blue", 0);
            }

            if (!TeamExtensions.isTeamScoreSet("Red"))
            {
                TeamExtensions.SetTeamScore("Red", 0);
            }

            if (isKillFeedEmpty)
            {
                TeamExtensions.AddKillFeed(-1, -1);
            }
        }
    }
    /*---------------------------- UPDATE ----------------------------*/

    // Update is called once per frame
    void Update()
    {
        PhotonView photonView = PhotonView.Get(this);

        /*------------------------- VERIFYING SYNCHRONIZATION -------------*/
        //We check if we have the scores of everyone

        /*if(!isUpdated) //We're not updated
         * {
         *      if(updateCounter >= 2.0f)
         *      {
         *              int myID = photonView.owner.ID;
         *
         *              photonView.RPC("updateMe", PhotonTargets.MasterClient, null);
         *              updateCounter = 0f;
         *              Debug.Log("Requesting update");
         *      }
         *      else
         *      {
         *              updateCounter += Time.deltaTime;
         *      }
         * }
         *
         * /*----------------------------- WE UPDATE THE PLAYERS REGULARLY -----------*/
        if (PhotonNetwork.isMasterClient)
        {
            /*if(updateTimer >= 2.0f)
             * {
             *      string theTeamScores = blueScore + ";" + redScore;
             *      photonView.RPC("updateTeamScores", PhotonTargets.Others, theTeamScores);
             *      updateTimer = 0f;
             * }
             * else
             * {
             *      updateTimer += Time.deltaTime;
             * }*/

            if (pingUpdate >= 5.0f)
            {
                pingFunction();
                pingUpdate = 0f;
            }
            else
            {
                pingUpdate += Time.deltaTime;
            }
            pingTimer += Time.deltaTime;
        }

        /*--------------------------------------------------------------------*/

        //When our playerCreator is created we add ourself on the scoreboards
        playerSpawn playSpawn = GetComponent <playerSpawn>();


        //Managing the kills

        //We update the last shot each frame
        foreach (Transform child in transform)
        {
            if (child.name != "globalHUD" && child.name != "scoreBoardUI" && child.name != "InGameMenu" && child.name != "littleScoreBoardUI" && child.name != "PlayerHUD")
            {
                playerNetwork playSet = child.GetComponent <playerNetwork>();
                myLastShot = playSet.lastShot;
            }
        }

        //If we're killed we add the kill and update the score
        if (wasKilled)
        {
            PhotonPlayer    killer            = PhotonPlayer.Find(myLastShot);
            PunPlayerScores playerScoreScript = GetComponent <PunPlayerScores>();
            ScoreExtensions.AddScore(killer, 1);

            int myID = photonView.owner.ID;
            //photonView.RPC("addKill", killer, null);
            //photonView.RPC("addKill", PhotonTargets.All, myLastShot);

            if (myTeam == "Blue")
            {
                //photonView.RPC("addRedKill", PhotonTargets.All, myLastShot);
                //photonView.RPC("addRedKill", PhotonTargets.All, null);
                TeamExtensions.AddTeamScore("Red");
                //photonView.RPC("addBlueDeath", PhotonTargets.All, myID);
            }
            else
            {
                //photonView.RPC("addBlueKill", PhotonTargets.All, myLastShot);
                //photonView.RPC("addBlueKill", PhotonTargets.All, null);
                TeamExtensions.AddTeamScore("Blue");
                //photonView.RPC("addRedDeath", PhotonTargets.All, myID);
            }

            PhotonPlayer myPlayer = PhotonPlayer.Find(myID);
            //addDeath();
            DeathExtensions.AddDeath(myPlayer, 1);

            //KILLFEED
            TeamExtensions.AddKillFeed(myLastShot, myID);
            wasKilled = false;
        }

        /*--------------------------- SCOREBOARD ----------------------*/

        //We get the scoreboard object
        Transform scoreB = transform.Find("scoreBoardUI");

        //Drawing the score
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            drawTheScore = true;
        }
        if (Input.GetKeyUp(KeyCode.Tab))
        {
            drawTheScore = false;
        }

        if (photonView.isMine)
        {
            if (drawTheScore || isMatchEnded)            //If the player press tab we activate the board
            {
                scoreB.gameObject.active = true;
            }
            else
            {
                scoreB.gameObject.active = false;
            }
        }
        else
        {
            scoreB.gameObject.active = false;
        }

        /*------------------------------ TIMER ------------------------*/

        //At the end of the match the masterclient stops it
        if (matchTimer <= 0f)
        {
            if (PhotonNetwork.isMasterClient)
            {
                photonView.RPC("stopMatch", PhotonTargets.All, null);
            }
        }
        else
        {
            matchTimer -= Time.deltaTime;

            //if(PhotonNetwork.isMasterClient)
            //updateMatchTimer();
        }
    }