Example #1
0
    public void CaptureFlag()
    {
        if (grabbedObject != null)
        {
            DropObject();

            IncreaseTeamScore(ourTeam);
            IncreasePlayerScore();
            //If we're red team, reset the blue flag
            if (ourTeam == PunTeams.Team.red)
            {
                GetComponent <PhotonView> ().RPC("ResetFlag", PhotonTargets.AllBuffered, PunTeams.Team.blue);
                textManager.AddFlagCaptureMessage(PunTeams.Team.red);
            }
            else
            {
                GetComponent <PhotonView> ().RPC("ResetFlag", PhotonTargets.AllBuffered, PunTeams.Team.red);
                textManager.AddFlagCaptureMessage(PunTeams.Team.blue);
            }

            // Play flag captured sound effect
            GetComponent <PhotonView>().RPC("PlayFlagCaptureNotification", PhotonTargets.AllBuffered);
        }
    }