private void CharacterController_OnCollision(object sender, PhysicsBodyComponent e) { if (this.intel == null) { Intel intel = e.GameObject as Intel; if (intel != null) { if (intel.RequestOwnership(this)) { DashCMD.WriteLine("[SPPlayer] Picked up the intel", ConsoleColor.Green); this.intel = intel; intel.IsIconVisible = false; } } } CommandPost commandPost = e.GameObject as CommandPost; if (commandPost != null) { if (commandPost.Team == Team) { Refresh(); if (intel != null) { intel.Return(); intel.IsIconVisible = true; intel = null; } } } }
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); }