protected virtual void SetBlock(SuperBlock block, TBlockSubtypes subtypeId, bool addSubtype = true) { this.block = block; this.SubtypeId = subtypeId; if (addSubtype) { block.SubtypeId |= subtypeId; block.subtypeAccessors.Add(this); } }
public static TBlockSubtypes GetLargestSubtype(this TBlockSubtypes subtypeId) { for (int n = subtypes.Count - 1; n >= 0; n--) { if ((subtypeId & subtypes[n]) == subtypes[n]) { return(subtypes[n]); } } return(TBlockSubtypes.None); }
protected override void SetBlock(SuperBlock block, TBlockSubtypes subtypeId, bool addSubtype = true) { this.block = block; subtype = block.TBlock as T; this.SubtypeId = subtypeId; if (addSubtype && subtype != null) { block.SubtypeId |= subtypeId; block.subtypeAccessors.Add(this); } }
public virtual void Reset() { for (int i = 0; i < subtypeAccessors.Count; i++) { subtypeAccessors[i].Reset(); } if (TBlock != null) { TBlock.OnMarkForClose -= BlockClosing; } subtypeAccessors.Clear(); TypeID = null; TBlock = null; TerminalGrid = null; SubtypeId = 0; }
public static bool UsesSubtype(this TBlockSubtypes subtypeId, TBlockSubtypes flag) => (subtypeId & flag) == flag;
protected virtual void SetBlock(SuperBlock block, TBlockSubtypes subtypeId, TBlockSubtypes prerequsites) => SetBlock(block, subtypeId, block.SubtypeId.UsesSubtype(prerequsites));
public virtual void Reset() { SubtypeId = TBlockSubtypes.None; block = null; }