Exemple #1
0
 public void OnTriggerEnter(Collider other)
 {
     if (other.transform.tag == forTaggedGO)
     {
         PhotonPlayer player = other.GetComponent <PhotonView>().owner;
         if (player != null &&
             other.GetComponent <PhotonView>().isMine &&
             player.GetAttribute <bool>(PlayerAttributes.HASSPAWNED, false) &&
             player.GetPlayerState() == PlayerState.inGame)
         {
             int tid = player.getTeamID();
             if (tid == 1 || tid == 2)
             {
                 playerInZone.Add(player);
                 countsHasChanged = true;
                 player.SetAttribute(PlayerAttributes.INPRISONZONE, true);
             }
             if (tid == 1 && player.GetAttribute <bool>(PlayerAttributes.ISCAPTURED, false))
             {
                 player.SetAttribute(PlayerAttributes.ISCAPTURED, false);
                 ChatVik.SendRoomMessage(player.NickName + " s'est évadé de prison !");
             }
         }
     }
 }
Exemple #2
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.transform.tag == forTaggedGO)
        {
            PhotonPlayer player = other.GetComponent <PhotonView>().owner;

            if (player != null &&
                other.GetComponent <PhotonView>().isMine &&
                player.GetAttribute <bool>(PlayerAttributes.HASSPAWNED, false) &&
                player.GetPlayerState() == PlayerState.inGame)
            {
                int team = player.getTeamID();                        //verification de l'équipe du joueur present dans la zone
                if (team == 1)
                {
                    if (PhotonNetwork.room.GetRoomState() == GameState.RoundRunning)
                    {
                        player.AddPlayerScore(PointGenere);
                        PhotonNetwork.room.AddTeamScore(1, PointGenere);
                    }

                    Manager_game.ActiveZonesList.Remove(gameObject);
                    //destruction de la zone
                    photonView.RPC("rpc_UnspawnThiefZone", PhotonTargets.MasterClient);
                }
            }
        }
    }
Exemple #3
0
 public void OnTriggerExit(Collider other)
 {
     if (other.transform.tag == forTaggedGO)
     {
         PhotonPlayer player = other.GetComponent <PhotonView>().owner;
         if (player != null &&
             other.GetComponent <PhotonView>().isMine &&
             player.GetAttribute <bool>(PlayerAttributes.HASSPAWNED, false) &&
             player.GetAttribute <string>(PlayerAttributes.INZONE, "") == zoneName &&
             player.GetPlayerState() == PlayerState.inGame)
         {
             //print("Player " + other.name + " left " + zoneName);
             player.SetAttribute(PlayerAttributes.INZONE, "");
         }
     }
 }
Exemple #4
0
    public void rpc_UnspawnPlayerAvatar(PhotonPlayer player)
    {
        if (!PhotonNetwork.inRoom || !player.GetAttribute <bool>(PlayerAttributes.HASSPAWNED, false))
        {
            return;
        }

        //RESET DE LAA CAMERA UNIQUEMENT CHEZ LE CLIENT CONCERNEE
        if (PhotonNetwork.player == player)
        {
            ResetCameraTransform();
            //DESTROY AVATAR UNIQUEMENT PAR LE MASTERCLIENT
            //PhotonNetwork.DestroyPlayerObjects(player);
            DestroyPlayerCharacters(player);
            PlayerAvatar = null;
            player.SetAttribute(PlayerAttributes.HASSPAWNED, false);
        }
    }
Exemple #5
0
 public void OnTriggerExit(Collider other)
 {
     if (other.transform.tag == forTaggedGO)
     {
         PhotonPlayer player = other.GetComponent <PhotonView>().owner;
         if (player != null &&
             other.GetComponent <PhotonView>().isMine &&
             player.GetAttribute <bool>(PlayerAttributes.HASSPAWNED, false) &&
             player.GetPlayerState() == PlayerState.inGame)
         {
             int tid = player.getTeamID();
             if (tid == 1 || tid == 2)
             {
                 playerInZone.Remove(player);
                 player.SetAttribute(PlayerAttributes.INPRISONZONE, false);
                 countsHasChanged = true;
             }
         }
     }
 }
Exemple #6
0
 string getPlayerStrState(PhotonPlayer player)
 {
     return(player.GetAttribute(PlayerAttributes.ISCAPTURED, false) ? "Captured" : player.GetPlayerState() == PlayerState.inGame ? "ig" : player.GetAttribute(PlayerAttributes.ISREADY, false) ? "Ready" : "-");
 }
 public static bool isGameAdmin(this PhotonPlayer player)
 {
     return(PhotonNetwork.inRoom && player.GetAttribute <bool>(PlayerAttributes.ISROOMADMIN, false));
 }
 public static void AddPlayerCaptureScore(this PhotonPlayer player, int value)
 {
     player.SetAttribute(PlayerAttributes.CAPTURESCORE, player.GetAttribute(PlayerAttributes.CAPTURESCORE, 0) + value);
 }
 public static int getTeamID(this PhotonPlayer player)
 {
     return(player.GetAttribute <int>(PlayerAttributes.TEAM, 0));
 }
 public static PlayerState GetPlayerState(this PhotonPlayer player)
 {
     return(player.GetAttribute <PlayerState>(PlayerAttributes.PLAYERSTATE, PlayerState.PlayerState_error));
 }