예제 #1
0
        public void AddedToWorld(Actor self)
        {
            var width        = bi.Dimensions.X;
            var bibOffset    = bi.Dimensions.Y - 1;
            var centerOffset = FootprintUtils.CenterOffset(bi);
            var location     = self.Location;
            var rows         = info.HasMinibib ? 1 : 2;

            for (var i = 0; i < rows * width; i++)
            {
                var index      = i;
                var anim       = new Animation(self.World, rs.GetImage(self));
                var cellOffset = new CVec(i % width, i / width + bibOffset);

                // Some mods may define terrain-specific bibs
                var terrain      = self.World.GetTerrainType(location + cellOffset);
                var testSequence = info.Sequence + "-" + terrain;
                var sequence     = anim.HasSequence(testSequence) ? testSequence : info.Sequence;
                anim.PlayFetchIndex(sequence, () => index);
                anim.IsDecoration = true;

                // Z-order is one set to the top of the footprint
                var offset = cellOffset.ToWVec() - centerOffset;
                var awo    = new AnimationWithOffset(anim, () => offset, null, -(offset.Y + centerOffset.Y + 512));
                rs.Add("bib_{0}".F(i), awo, info.Palette);
            }
        }
예제 #2
0
 public static int GetFacing(CVec d, int currentFacing)
 {
     return(GetFacing(d.ToWVec(), currentFacing));
 }