예제 #1
0
        public WithIdleOverlay(Actor self, WithIdleOverlayInfo info)
        {
            var rs   = self.Trait <RenderSprites>();
            var body = self.Trait <IBodyOrientation>();

            buildComplete = !self.HasTrait <Building>();            // always render instantly for units
            overlay       = new Animation(rs.GetImage(self));
            overlay.PlayRepeating(info.Sequence);
            rs.anims.Add("idle_overlay_{0}".F(info.Sequence),
                         new AnimationWithOffset(overlay,
                                                 () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
                                                 () => !buildComplete, p => WithTurret.ZOffsetFromCenter(self, p, 1)));
        }
예제 #2
0
        public WithIdleOverlay(Actor self, WithIdleOverlayInfo info)
        {
            var rs       = self.Trait <RenderSprites>();
            var body     = self.Trait <IBodyOrientation>();
            var disabled = self.TraitsImplementing <IDisable>();

            buildComplete = !self.HasTrait <Building>();            // always render instantly for units
            overlay       = new Animation(self.World, rs.GetImage(self));
            overlay.PlayRepeating(info.Sequence);
            rs.Add("idle_overlay_{0}".F(info.Sequence),
                   new AnimationWithOffset(overlay,
                                           () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
                                           () => !buildComplete,
                                           () => info.PauseOnLowPower && disabled.Any(d => d.Disabled),
                                           p => WithTurret.ZOffsetFromCenter(self, p, 1)),
                   info.Palette, info.IsPlayerPalette);
        }