public OctoSubTile(OctoMask m, Sprite s, float w) { mask = m; sprite = s; weight = w; }
static public bool HasNoOtherBits(this OctoMask item, OctoMask target) { if (item.GetBits().HasNoOtherBits(target.GetBits())) { return(true); } return(false); }
public override Sprite GetApplicableSprite(Vector3Int position, ITilemap tilemap) { int hash = position.GetHashCode(); OctoMask mask = tilemap.GetOctoMask(position, t => t.EqualsEX(this)); if (randomize_with_position) { hash = hash.AbsorbObjectHash(tilemap.GetComponent <Transform>().GetSpacarPosition()); } return(cache.Fetch(mask) .PickACongruent(hash, t => t.GetWeight()) .IfNotNull(t => t.GetSprite())); }
static public bool HasBitAt(this OctoMask item, int dx, int dy) { int index; if (OctoMaskExtensions.TryGetBitIndex(dx, dy, out index)) { if (item.GetBits().HasNthBit(index)) { return(true); } } return(false); }
static public byte GetComplexity(this OctoMask item) { return(item.GetBits().GetNumberBits()); }
static public OctoMask GetWithoutBitAt(this OctoMask item, int dx, int dy) { return(new OctoMask(item.GetBits().GetBitExclusion(OctoMaskExtensions.GetBitValue(dx, dy)))); }