public void SpawnDeathAnimation(Actor self, string sequence, string palette) { self.World.AddFrameEndTask(w => { if (!self.Destroyed) { w.Add(new Corpse(w, self.CenterPosition, renderSimple.GetImage(self), sequence, palette)); } }); }
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 string EditorImage(ActorInfo actor) { return(RenderSimple.GetImage(actor)); }