Example #1
0
 public RenderInfantry(Actor self, RenderInfantryInfo info)
     : base(self, RenderSimple.MakeFacingFunc(self))
 {
     Info = info;
     anim.PlayFetchIndex(NormalizeInfantrySequence(self, "stand"), () => 0);
     State  = AnimationState.Waiting;
     mobile = self.Trait <Mobile>();
 }
Example #2
0
        public WithHarvestAnimation(Actor self, WithHarvestAnimationInfo info)
        {
            this.info = info;
            var rs   = self.Trait <RenderSprites>();
            var body = self.Trait <IBodyOrientation>();

            anim = new Animation(rs.GetImage(self), RenderSimple.MakeFacingFunc(self));
            anim.Play(info.Sequence);
            rs.anims.Add("harvest_{0}".F(info.Sequence), new AnimationWithOffset(anim,
                                                                                 () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
                                                                                 () => !visible,
                                                                                 p => WithTurret.ZOffsetFromCenter(self, p, 0)));
        }
Example #3
0
        public WithResources(Actor self, WithResourcesInfo info)
        {
            this.info       = info;
            rs              = self.Trait <RenderSimple>();
            playerResources = self.Owner.PlayerActor.Trait <PlayerResources>();

            anim = new Animation(rs.GetImage(self));
            anim.PlayFetchIndex(info.Sequence,
                                () => playerResources.OreCapacity != 0
                                            ? ((10 * anim.CurrentSequence.Length - 1) * playerResources.Ore) / (10 * playerResources.OreCapacity)
                                            : 0);

            rs.anims.Add("resources_{0}".F(info.Sequence), new AnimationWithOffset(
                             anim, null, () => !buildComplete, 1024));
        }
        public override IEnumerable <Renderable> RenderPreview(ActorInfo building, Player owner)
        {
            var p = BaseBuildingPreview(building, owner);

            foreach (var r in p)
            {
                yield return(r);
            }

            var anim = new Animation(RenderSimple.GetImage(building), () => 0);

            anim.PlayRepeating("idle-top");
            var rb = building.Traits.Get <RenderBuildingInfo>();

            yield return(new Renderable(anim.Image, rb.Origin + 0.5f * anim.Image.size * (1 - Scale), p.First().Palette, 0, Scale));
        }
 public WithBuildingPlacedAnimation(Actor self, WithBuildingPlacedAnimationInfo info)
 {
     this.info    = info;
     renderSimple = self.Trait <RenderSimple>();
 }
Example #6
0
 public string EditorImage(ActorInfo actor)
 {
     return(RenderSimple.GetImage(actor));
 }
Example #7
0
 public WithDeathAnimation(Actor self, WithDeathAnimationInfo info)
 {
     Info         = info;
     renderSimple = self.Trait <RenderSimple>();
 }
Example #8
0
 public RenderUnit(Actor self)
     : base(self, RenderSimple.MakeFacingFunc(self))
 {
     anim.PlayRepeating("idle");
 }