コード例 #1
0
 /// <summary>Clear out the characters to prepare for next set.</summary>
 public static void Clear()
 {
     foreach (var character in Characters)
     {
         Destroy(character.gameObject);
     }
     Characters.Clear();
     OnPlayerSpawned.RemoveAllListeners();
     OnPlayerRemoved.RemoveAllListeners();
 }
コード例 #2
0
        public static void RemovePlayer(string name)
        {
            GetInstance();

            if (instance.players.ContainsKey(name))
            {
                Player aPlayer = instance.players[name];
                instance.players.Remove(name);
                OnPlayerRemoved?.Invoke(aPlayer);
            }
        }
コード例 #3
0
        public static void Clear()
        {
            Player[] removedPlayers = players_.ToArray();

            players_.Clear();

            foreach (Player player in removedPlayers)
            {
                OnPlayerRemoved.Invoke(player);
            }
        }
コード例 #4
0
 public bool RemovePlayer(PinouPlayer player)
 {
     if (player != null)
     {
         player.Destroy();
         _players.Remove(player);
         OnPlayerRemoved.Invoke(player);
         return(true);
     }
     return(false);
 }
コード例 #5
0
        /// <summary>
        /// Удалить игрока из игры
        /// </summary>
        /// <param name="parPlayerId">Данные об удаляемом игроке</param>
        public void RemovePlayer(string parPlayerId)
        {
            MPlayer foundPlayer = _players.FirstOrDefault(parX => parX.PlayerId == parPlayerId);

            if (foundPlayer == null)
            {
                return;
            }

            _players.Remove(foundPlayer);
            OnPlayerRemoved?.Invoke(foundPlayer);
        }
コード例 #6
0
        private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
        {
            var currentLength = Game1.otherFarmers.Count;

            if (currentLength > _prevLength)
            {
                _monitor.VerboseLog("Player added");
                OnPlayerAdded?.Invoke();
                _prevLength = currentLength;
            }
            else if (currentLength < _prevLength)
            {
                _monitor.VerboseLog("Player removed");
                OnPlayerRemoved?.Invoke();
                _prevLength = currentLength;
            }
        }
コード例 #7
0
 public void RemovePlayer(int playerIndex)
 {
     if (activePlayers.Count > playerIndex)
     {
         var psData = activePlayers[playerIndex];
         activePlayers.RemoveAt(playerIndex);
         OnPlayerRemoved?.Invoke(psData);
         for (int i = playerIndex; i < maxNumberOfPlayers; i++)
         {
             if (i < activePlayers.Count && activePlayers[i] != null)
             {
                 PlayerSessionData pData = activePlayers[i];
                 pData.playerIndex = i;
                 OnPlayerChangedIndex?.Invoke(pData, i + 1);
             }
         }
     }
 }
コード例 #8
0
 /// <summary>
 /// Deregisters a player from this dict.
 /// </summary>
 /// <param name="player">The player to be removed.</param>
 public void DeRegister(Player player)
 {
     Players.Remove(player);
     OnPlayerRemoved?.Invoke(player);
 }
コード例 #9
0
 public static void Remove(Player player)
 {
     players_.Remove(player);
     OnPlayerRemoved.Invoke(player);
 }