コード例 #1
0
ファイル: WithDeathAnimation.cs プロジェクト: wytsep/OpenRA
 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));
         }
     });
 }
コード例 #2
0
ファイル: WithResources.cs プロジェクト: epicelite/OpenRA
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
ファイル: RenderSimple.cs プロジェクト: wytsep/OpenRA
 public string EditorImage(ActorInfo actor)
 {
     return(RenderSimple.GetImage(actor));
 }