public WithMuzzlePaletteSpriteTurret(Actor self, WithSpriteTurretInfo info) : base(self, info)
        {
            var renderSprites = self.Trait <RenderSprites>();
            var turreted      = self.TraitsImplementing <Turreted>().First(tt => tt.Name == info.Turret);
            var buildComplete = !self.Info.HasTraitInfo <BuildingInfo>();

            muzzle = new Animation(self.World, renderSprites.GetImage(self), () => turreted.TurretFacing);
            muzzle.PlayRepeating(NormalizeSequence(self, info.Sequence));
            renderSprites.Add(new AnimationWithOffset(muzzle,
                                                      () => TurretOffset(self),
                                                      () => IsTraitDisabled || !buildComplete || !fire,
                                                      p => RenderUtils.ZOffsetFromCenter(self, p, 1)), "muzzle");
        }
Example #2
0
 public WithOffsetsSpriteTurret(Actor self, WithSpriteTurretInfo info)
     : base(self, info)
 {
     wsb = self.Trait <WithSpriteBody>();
 }