示例#1
0
        public OctoSubTile(OctoMask m, Sprite s, float w)
        {
            mask   = m;
            sprite = s;

            weight = w;
        }
示例#2
0
        static public bool HasNoOtherBits(this OctoMask item, OctoMask target)
        {
            if (item.GetBits().HasNoOtherBits(target.GetBits()))
            {
                return(true);
            }

            return(false);
        }
示例#3
0
        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()));
        }
示例#4
0
        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);
        }
示例#5
0
 static public byte GetComplexity(this OctoMask item)
 {
     return(item.GetBits().GetNumberBits());
 }
示例#6
0
 static public OctoMask GetWithoutBitAt(this OctoMask item, int dx, int dy)
 {
     return(new OctoMask(item.GetBits().GetBitExclusion(OctoMaskExtensions.GetBitValue(dx, dy))));
 }