示例#1
0
        public void RemoveForPlayer(ushort playerId)
        {
            RemotePlayerVitals removedPlayerVitals = CreateForPlayer(playerId);

            vitalsByPlayerId.Remove(playerId);

            Object.Destroy(removedPlayerVitals);
        }
示例#2
0
        public override void Process(PlayerStats playerStats)
        {
            RemotePlayerVitals vitals = vitalsManager.CreateForPlayer(playerStats.PlayerId);

            vitals.SetOxygen(playerStats.Oxygen, playerStats.MaxOxygen);
            vitals.SetHealth(playerStats.Health);
            vitals.SetFood(playerStats.Food);
            vitals.SetWater(playerStats.Water);
        }
示例#3
0
        public RemotePlayerVitals CreateForPlayer(ushort playerId)
        {
            if (!vitalsByPlayerId.TryGetValue(playerId, out RemotePlayerVitals vitals))
            {
                vitals = RemotePlayerVitals.CreateForPlayer(playerId);
                vitalsByPlayerId[playerId] = vitals;
            }

            return(vitals);
        }
示例#4
0
        public void RemovePlayer(ulong playerId)
        {
            RemotePlayerVitals removedPlayerVitals = GetForPlayerId(playerId);

            vitalsByPlayerId.Remove(playerId);

            Object.Destroy(removedPlayerVitals);

            int i = 1;

            foreach (RemotePlayerVitals vitals in vitalsByPlayerId.Values)
            {
                vitals.SetNewPosition(i++);
            }
        }