コード例 #1
0
        public override IEnumerable <IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
        {
            // Show a static frame instead of animating all of the fullness states
            var anim = new Animation(init.World, image, () => 0);

            anim.PlayFetchIndex("idle", () => 0);

            yield return(new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale));
        }
コード例 #2
0
ファイル: RenderSimple.cs プロジェクト: wytsep/OpenRA
        public virtual IEnumerable <IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
        {
            var ifacing = init.Actor.Traits.GetOrDefault <IFacingInfo>();
            var facing  = ifacing != null?init.Contains <FacingInit>() ? init.Get <FacingInit, int>() : ifacing.GetInitialFacing() : 0;

            var anim = new Animation(init.World, image, () => facing);

            anim.PlayRepeating("idle");
            yield return(new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale));
        }
コード例 #3
0
        public override IEnumerable <IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
        {
            var t = init.Actor.Traits.WithInterface <TurretedInfo>()
                    .FirstOrDefault();

            // Show the correct turret facing
            var anim = new Animation(init.World, image, () => t.InitialFacing);

            anim.PlayRepeating("idle");

            yield return(new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale));
        }
コード例 #4
0
        public override IEnumerable <IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
        {
            foreach (var orig in base.RenderPreviewSprites(init, rs, image, facings, p))
            {
                yield return(orig);
            }

            // Show additional roof overlay
            var anim = new Animation(init.World, image, () => 0);

            anim.PlayRepeating("idle-top");

            var bi     = init.Actor.Traits.Get <BuildingInfo>();
            var offset = FootprintUtils.CenterOffset(init.World, bi).Y + 512;

            yield return(new SpriteActorPreview(anim, WVec.Zero, offset, p, rs.Scale));
        }
コード例 #5
0
ファイル: RenderSprites.cs プロジェクト: wytsep/OpenRA
 public RenderSprites(Actor self)
 {
     info = self.Info.Traits.Get <RenderSpritesInfo>();
 }