public void DestroyPortal(Portal portal, Faction newFaction = Faction.None) { Faction destroyedFaction = portal.Model.Faction; // First, process the model for links and CFs IList <LinkModel> destroyedLinkModels; IList <CFModel> destroyedCFModels; LinkManager.DestroyPortal(portal.Model, out destroyedLinkModels, out destroyedCFModels); var destroyedCFs = destroyedCFModels.Select(ModelToView).ToList(); var destroyedLinks = destroyedLinkModels.Select(ModelToView).ToList(); Debug.Log(string.Format("{0} links and {1} CFs ({2} MUs) are destroyed.", destroyedLinkModels.Count(), destroyedCFModels.Count(), destroyedCFModels.Sum(cf => cf.MU))); var achievement = portal.DestroyerAchievement ?? AchievementModel.DummyAchievement; achievement.DestroyPortal(); // Second, process the view for links and CFs // CFs foreach (var cfs in destroyedCFs) { CFs.Remove(cfs); Destroy(cfs.gameObject); achievement.DestroyCF(); } if (destroyedCFs.Any()) { SoundManager.GetInstance().CFDestroyedSound.Play(); } // Links foreach (var link in destroyedLinks) { Links.Remove(link); Destroy(link.gameObject); achievement.DestroyLink(); } Scoreboard.DisplayMU(destroyedFaction, LinkManager.GetMU(destroyedFaction)); // Finally, process the portal CapturePortal(portal, newFaction); UpdateDeadPortals(); }