/// <summary> /// Checks if the upgrade is unlocked /// </summary> /// <param name="id">The ID to check</param> /// <param name="catcher">The catcher itself</param> /// <returns>True if unlocked, false otherwise</returns> public bool IsUnlocked(Identifiable.Id id, SiloCatcher catcher) { if (unlocked) { return(true); } unlocked = lockerCheck?.Invoke(id, catcher) ?? true; return(unlocked); }
internal static bool CheckCatcherLocks(Identifiable.Id id, SiloCatcher catcher) { if (!STORAGE_LOCKS.ContainsKey(id)) { return(true); } foreach (CatcherLocker locker in CATCHER_LOCKS[id]) { if (!locker.IsUnlocked(id, catcher)) { return(false); } } return(true); }
public static bool Alternate(SiloCatcher catcher, Identifiable.Id id, Collider collider) { switch (catcher.type) { case SiloCatcher.Type.SILO_DEFAULT: bool result = catcher.storageSilo.GetRelevantAmmo().MaybeAddToSpecificSlot(id, collider.GetComponent <Identifiable>(), catcher.slotIdx, 1, false); catcher.storageSilo.OnAdded(); return(result); case SiloCatcher.Type.REFINERY: return(SRSingleton <SceneContext> .Instance.GadgetDirector.AddToRefinery(id)); case SiloCatcher.Type.DECORIZER: return(catcher.storageDecorizer.Add(id)); case SiloCatcher.Type.VIKTOR_STORAGE: return(catcher.storageGlitch.Add(id)); } throw new ArgumentException(catcher.type.ToString()); }
/// <summary>Checks if a catcher can receive a specific item</summary> public static bool CanCatcherReceive(Identifiable.Id id, SiloCatcher catcher) => AmmoRegistry.CheckCatcherLocks(id, catcher);
public static void Decrement(SiloCatcher catcher) { catcher.StartCoroutine(Coroutine(catcher.storageSilo.GetRelevantAmmo())); }