Beispiel #1
0
        public WithBuildingPlacedOverlay(Actor self, WithBuildingPlacedOverlayInfo info)
        {
            var rs   = self.Trait <RenderSprites>();
            var body = self.Trait <IBodyOrientation>();

            buildComplete = !self.HasTrait <Building>();            // always render instantly for units

            overlay = new Animation(self.World, rs.GetImage(self));
            overlay.Play(info.Sequence);
            rs.Add("crane_overlay_{0}".F(info.Sequence),
                   new AnimationWithOffset(overlay,
                                           () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
                                           () => !buildComplete),
                   info.Palette, info.IsPlayerPalette);
        }
Beispiel #2
0
        public WithBuildingPlacedOverlay(Actor self, WithBuildingPlacedOverlayInfo 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));

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

            overlay.PlayThen(info.Sequence, () => visible = false);
            rs.Add(anim, info.Palette, info.IsPlayerPalette);
        }