Ejemplo n.º 1
0
 public static PlayerTracker GetInstance()
 {
     if (instance == null)
     {
         instance = new PlayerTracker();
     }
     return(instance);
 }
Ejemplo n.º 2
0
 private TeamTracker()
 {
     foreach (GameObject player in PlayerTracker.GetInstance().GetPlayers())
     {
         AddTeamTrackingToPlayers(player);
     }
     PlayerTracker.GetInstance().OnPlayerAdded   += AddTeamTrackingToPlayers;
     PlayerTracker.GetInstance().OnPlayerRemoved += (GameObject player) => {
         CountTeams();
     };
 }
Ejemplo n.º 3
0
        private void CountTeams()
        {
            vips = inhumers = 0;
            foreach (GameObject player in PlayerTracker.GetInstance().GetPlayers())
            {
                if (player.GetComponent <PlayerDataForClients>().GetTeam() == PlayerDataForClients.TEAM_VIP)
                {
                    vips++;
                }
                else if (player.GetComponent <PlayerDataForClients>().GetTeam() == PlayerDataForClients.TEAM_INHUMER)
                {
                    inhumers++;
                }
            }

            if (OnTeamChanged != null)
            {
                OnTeamChanged(vips, inhumers);
            }
        }
Ejemplo n.º 4
0
 public void OnDestroy()
 {
     PlayerTracker.GetInstance().RemovePlayer(gameObject);
 }
Ejemplo n.º 5
0
 public override void OnStartLocalPlayer()
 {
     PlayerTracker.GetInstance().SetLocalPlayer(gameObject);
 }
Ejemplo n.º 6
0
 private void UpdatePlayerIsServer(GameObject player, bool isServer)
 {
     PlayerTracker.GetInstance().SetServerPlayer(gameObject);
 }
Ejemplo n.º 7
0
        public override void OnStartClient()
        {
            PlayerTracker.GetInstance().AddPlayer(gameObject);

            gameObject.GetComponent <PlayerDataForClients>().OnIsServerFlagUpdated += UpdatePlayerIsServer;
        }