コード例 #1
0
ファイル: WithRepairOverlay.cs プロジェクト: zidonuke/OpenRA
        public WithRepairOverlay(Actor self, WithRepairOverlayInfo info)
        {
            var rs   = self.Trait <RenderSprites>();
            var body = self.Trait <BodyOrientation>();

            buildComplete = !self.Info.HasTraitInfo <BuildingInfo>();            // always render instantly for units
            overlay       = new Animation(self.World, rs.GetImage(self),
                                          () => info.PauseOnLowPower && self.IsDisabled());
            overlay.PlayThen(info.Sequence, () => visible = false);

            var anim = new AnimationWithOffset(overlay,
                                               () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
                                               () => !visible || !buildComplete,
                                               p => RenderUtils.ZOffsetFromCenter(self, p, 1));

            rs.Add(anim, info.Palette, info.IsPlayerPalette);
        }
コード例 #2
0
        public WithRepairOverlay(Actor self, WithRepairOverlayInfo 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.Play(info.Sequence);
            rs.Add("repair_{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);
        }