Facebook
From Mateo, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 57
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Photon.Realtime;
  5. using Photon.Pun;
  6. using Photon.Pun.UtilityScripts;
  7.  
  8. public class GameManager : MonoBehaviourPunCallbacks
  9. {
  10.     public GameObject[] spawnPointsBlue;
  11.     public GameObject[] spawnPointsRed;
  12.     public Player[] meinTeamArray;
  13.  
  14.     [SerializeField] private PhotonTeamsManager pt;
  15.    
  16.     void Awake()
  17.     {
  18.         if (PhotonNetwork.IsConnected)
  19.         {
  20.             //Wichtig!!!! Die Custom Propertie für das Team heisst: "_pt" und ist bei Team Blau 1 und bei Team Rot 2!!!!!
  21.  
  22.             if (PhotonNetwork.LocalPlayer.CustomProperties[1] == "_pt")
  23.             {
  24.                 Debug.Log("PhotonNetwork.LocalPlayer.CustomProperties[1] == _pt" + " war richtig");
  25.             }
  26.  
  27.             if (PhotonNetwork.LocalPlayer.CustomProperties["_pt"] == "1")
  28.             {
  29.                 Debug.Log("PhotonNetwork.LocalPlayer.CustomProperties[_pt] == 1" + " war richtig");
  30.             }
  31.  
  32.             if (PhotonNetwork.LocalPlayer.CustomProperties[2] == "_pt")
  33.             {
  34.                 Debug.Log("PhotonNetwork.LocalPlayer.CustomProperties[2] == _pt" + " war richtig");
  35.             }
  36.  
  37.             if (PhotonNetwork.LocalPlayer.CustomProperties["_pt"] == "2")
  38.             {
  39.                 Debug.Log("PhotonNetwork.LocalPlayer.CustomProperties[_pt] == 2" + " war richtig");
  40.             }
  41.  
  42.             /*
  43.             //Team als int bekommen:
  44.             var team = PhotonNetwork.LocalPlayer.CustomProperties["_pt"];
  45.  
  46.            
  47.  
  48.             if ((int)team == 1)
  49.             {
  50.                 //Blau
  51.                 float Z = Random.Range(-231, 72);
  52.                 PhotonNetwork.Instantiate("Player", new Vector3(-1100, 320, Z), Quaternion.identity);
  53.             }
  54.  
  55.             if ((int)team == 2)
  56.             {
  57.                 //Rot
  58.                 float Z = Random.Range(-231, 72);
  59.                 PhotonNetwork.Instantiate("Player", new Vector3(515, 320, Z), Quaternion.identity);
  60.             }
  61.  
  62.     */
  63.         }
  64.     }
  65. }