Ejemplo n.º 1
0
        public RenderBuilding(ActorInitializer init, RenderBuildingInfo info, Func <int> baseFacing)
            : base(init.self, baseFacing)
        {
            var self = init.self;

            this.info = info;

            DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
        }
Ejemplo n.º 2
0
        public RenderBuilding(ActorInitializer init, RenderBuildingInfo info, Func <int> baseFacing)
            : base(init.self, baseFacing)
        {
            var self = init.self;

            this.info = info;

            DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));

            self.Trait <IBodyOrientation>().SetAutodetectedFacings(DefaultAnimation.CurrentSequence.Facings);
        }
Ejemplo n.º 3
0
        public RenderBuildingWarFactory(ActorInitializer init, RenderBuildingInfo info)
            : base(init, info)
        {
            roof = new Animation(GetImage(init.self));
            var bi = init.self.Info.Traits.Get <BuildingInfo>();

            // Additional 512 units move from center -> top of cell
            var offset = FootprintUtils.CenterOffset(bi).Y + 512;

            anims.Add("roof", new AnimationWithOffset(roof, null,
                                                      () => !buildComplete, offset));
        }
Ejemplo n.º 4
0
        public RenderBuildingWarFactory(ActorInitializer init, RenderBuildingInfo info)
            : base(init, info)
        {
            roof = new Animation(GetImage(init.self));
            var offset = new AnimationWithOffset(roof)
            {
                ZOffset = 24
            };

            offset.DisableFunc = () => !buildComplete;
            anims.Add("roof", offset);
        }
        public RenderBuildingSeparateTurret(ActorInitializer init, RenderBuildingInfo info)
            : base(init, info)
        {
            var self     = init.self;
            var turreted = self.TraitsImplementing <Turreted>();

            var i = 0;

            foreach (var t in turreted)
            {
                var anim = new Animation(GetImage(self), () => t.turretFacing);
                anim.Play("turret");

                anims.Add("turret_{0}".F(i++), new AnimationWithOffset(anim,
                                                                       wr => wr.ScreenPxOffset(t.Position(self)), null));
            }
        }
Ejemplo n.º 6
0
        public RenderBuilding(ActorInitializer init, RenderBuildingInfo info, Func <int> baseFacing)
            : base(init.self, baseFacing)
        {
            var self = init.self;

            // Work around a bogus crash
            anim.PlayRepeating(NormalizeSequence(self, "idle"));
            self.Trait <IBodyOrientation>().SetAutodetectedFacings(anim.CurrentSequence.Facings);

            // Can't call Complete() directly from ctor because other traits haven't been inited yet
            if (self.Info.Traits.Get <RenderBuildingInfo>().HasMakeAnimation&& !init.Contains <SkipMakeAnimsInit>())
            {
                self.QueueActivity(new MakeAnimation(self, () => Complete(self)));
            }
            else
            {
                self.QueueActivity(new CallFunc(() => Complete(self)));
            }
        }
Ejemplo n.º 7
0
        public RenderBuildingSeparateTurret(ActorInitializer init, RenderBuildingInfo info)
            : base(init, info)
        {
            var turreted = init.self.Trait <Turreted>();
            var attack   = init.self.Trait <AttackBase>();

            var turretAnim = new Animation(GetImage(init.self), () => turreted.turretFacing);

            turretAnim.Play("turret");

            for (var i = 0; i < attack.Turrets.Count; i++)
            {
                var turret = attack.Turrets[i];
                anims.Add("turret_{0}".F(i),
                          new AnimationWithOffset(turretAnim,
                                                  () => Combat.GetTurretPosition(init.self, null, turret).ToFloat2(),
                                                  null));
            }
        }
Ejemplo n.º 8
0
 public RenderBuilding(ActorInitializer init, RenderBuildingInfo info)
     : this(init, info, () => 0)
 {
 }
Ejemplo n.º 9
0
 public RenderBuildingWall(ActorInitializer init, RenderBuildingInfo info)
     : base(init, info)
 {
     seqName = "idle";
 }
Ejemplo n.º 10
0
 public RenderBuildingTurreted(ActorInitializer init, RenderBuildingInfo info)
     : base(init, info, MakeTurretFacingFunc(init.self))
 {
     t = init.self.TraitsImplementing <Turreted>().FirstOrDefault();
     t.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;
 }
Ejemplo n.º 11
0
 public RenderBuildingTurreted(ActorInitializer init, RenderBuildingInfo info)
     : base(init, info, MakeTurretFacingFunc(init.self))
 {
 }
Ejemplo n.º 12
0
 public RenderBuildingSilo(ActorInitializer init, RenderBuildingInfo info)
     : base(init, info)
 {
     playerResources = init.self.Owner.PlayerActor.Trait <PlayerResources>();
 }