コード例 #1
0
ファイル: RenderInfantry.cs プロジェクト: test71/OpenRA
 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>();
 }
コード例 #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)));
        }
コード例 #3
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));
        }
コード例 #4
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));
        }
コード例 #5
0
 public WithBuildingPlacedAnimation(Actor self, WithBuildingPlacedAnimationInfo info)
 {
     this.info    = info;
     renderSimple = self.Trait <RenderSimple>();
 }
コード例 #6
0
ファイル: RenderSimple.cs プロジェクト: wytsep/OpenRA
 public string EditorImage(ActorInfo actor)
 {
     return(RenderSimple.GetImage(actor));
 }
コード例 #7
0
ファイル: WithDeathAnimation.cs プロジェクト: wytsep/OpenRA
 public WithDeathAnimation(Actor self, WithDeathAnimationInfo info)
 {
     Info         = info;
     renderSimple = self.Trait <RenderSimple>();
 }
コード例 #8
0
ファイル: RenderUnit.cs プロジェクト: watsoncui/OpenRA
 public RenderUnit(Actor self)
     : base(self, RenderSimple.MakeFacingFunc(self))
 {
     anim.PlayRepeating("idle");
 }