public void CreateLink(Faction faction, KeyInventoryModel inventory, Portal source, Portal target, AchievementModel achievement) { // Link var linkModel = LinkManager.AddLink(faction, inventory, source.Model, target.Model); Debug.Log(string.Format("Link {0} created.", linkModel)); Links.Add(Util.Instantiate(LinkPrefab, LinkLayer).Init(linkModel)); achievement.CreateLink(); // CF var cfModels = LinkManager.AddCFs(linkModel); if (cfModels.Any()) { var mu = cfModels.Sum(cfModel => cfModel.MU); Util.Instantiate(FloatingMUPrefab, null).Init(source.Model.Position, Mathf.FloorToInt(mu) + " MU", 0.8f); Debug.Log(string.Format("{0} CFs created total {1} MU", cfModels.Count(), mu)); Scoreboard.DisplayMU(faction, LinkManager.GetMU(faction)); foreach (var cfModel in cfModels) { CFs.Add(Util.Instantiate(CFPrefab, LinkLayer).Init(cfModel)); achievement.CreateCF(Mathf.FloorToInt(cfModel.MU)); } SoundManager.GetInstance().CFCreatedSound.Play(); } UpdateDeadPortals(); }
public IEnumerable <Portal> FindLinkablePortals(Faction faction, KeyInventoryModel inventory, Portal source) { var linkablePortalModels = LinkManager.FindLinkablePortals(faction, inventory, source.Model); return(linkablePortalModels.Select(ModelToView)); }