public void AddTo(Structure structure, GlobalStructureMod mod) { mod.TryApply(structure); TurretAssembly assembly = structure as TurretAssembly; foreach (var component in assembly.GetComponents()) { mod.TryApply(component); } }
public void RemoveFrom(Structure structure, GlobalStructureMod mod) { mod.RemoveFrom(structure); TurretAssembly assembly = structure as TurretAssembly; foreach (var component in assembly.GetComponents()) { mod.RemoveFrom(component); } }
private bool IsUnlocked(TurretAssembly assembly) => assembly.GetComponents().All(x => UnlockList.IsUnlocked(x.Identifier));
private bool CanUpgradeTo(Tier tier) { var cost = GetCost(tier); return(Player.Player.Resources.HasEnough(cost) && _assembly.GetComponents(tier).All(x => Player.Player.Unlocks.IsUnlocked(x.Identifier))); }
private bool ContainsComponent(TurretAssembly assembly, string identifier) => assembly.GetComponents().Any(x => x.Identifier == identifier);