private void ObjectComponent_OnCreatableDestroyed(object sender, NetCreatableInfo e)
        {
            ServerMPPlayer player = e.Creatable as ServerMPPlayer;

            if (player != null)
            {
                // Update network player
                NetworkPlayer netPlayer;
                if (NetPlayerComponent.TryGetPlayer(e.Owner, out netPlayer))
                {
                    netPlayer.CharacterId = null;
                }
            }
        }
Пример #2
0
        void CaptureIntel(ServerMPPlayer player, Intel intel)
        {
            intel.Return();

            string team = intel.Team == Team.A ? "Red" : "Blue";

            Screen.Chat(string.Format("The {0} intel has been captured!", team));

            if (player != null)
            {
                player.DropIntel();

                NetworkPlayer netPlayer;
                if (NetPlayerComponent.TryGetPlayer(player.StateInfo.Owner, out netPlayer))
                {
                    netPlayer.Score += SCORE_CAPTURE;

                    Screen.AddFeedItem(netPlayer.Name, "", World.GetTeamColor(player.Team),
                                       "Captured", "Intel", World.GetTeamColor(player.Team == Team.A ? Team.B : Team.A));
                }
            }
            else
            {
                Screen.AddFeedItem("?", null, World.GetTeamColor(intel.Team == Team.A ? Team.B : Team.A),
                                   "Captured", "Intel", World.GetTeamColor(intel.Team));
            }

            if (intel.Team == Team.B)
            {
                teamAScore++;
            }
            else
            {
                teamBScore++;
            }

            if (teamAScore < SCORE_CAP && teamBScore < SCORE_CAP)
            {
                NetChannel.FireEventForAllConnections("Client_IntelCaptured", (byte)intel.Team);
            }

            NetChannel.FireEventForAllConnections("Client_UpdateScores",
                                                  (short)teamAScore, (short)teamBScore);
        }
Пример #3
0
        private void Intel_OnDropped(object sender, Player _player)
        {
            Intel          intel  = (Intel)sender;
            ServerMPPlayer player = (ServerMPPlayer)_player;

            string team = intel.Team == Team.A ? "Red" : "Blue";

            Screen.Chat(string.Format("The {0} intel has been dropped!", team));

            NetworkPlayer netPlayer;

            if (NetPlayerComponent.TryGetPlayer(player.StateInfo.Owner, out netPlayer))
            {
                Screen.AddFeedItem(netPlayer.Name, "", World.GetTeamColor(player.Team),
                                   "Dropped", "Intel", World.GetTeamColor(intel.Team));
            }

            NetChannel.FireEventForAllConnections("Client_IntelDropped", (byte)intel.Team);
        }