Example #1
0
        public WithHarvestAnimation(Actor self, WithHarvestAnimationInfo info)
        {
            this.info = info;
            var rs   = self.Trait <RenderSprites>();
            var body = self.Trait <IBodyOrientation>();

            anim = new Animation(self.World, rs.GetImage(self), RenderSimple.MakeFacingFunc(self));
            anim.IsDecoration = true;
            anim.Play(info.Sequence);
            rs.Add(new AnimationWithOffset(anim,
                                           () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
                                           () => !visible,
                                           () => false,
                                           p => ZOffsetFromCenter(self, p, 0)), info.Palette);
        }
 public WithHarvestAnimation(ActorInitializer init, WithHarvestAnimationInfo info)
 {
     Info = info;
     harv = init.Self.Trait <Harvester>();
     wsb  = init.Self.Trait <WithSpriteBody>();
 }