public WithManaAnimation(ActorInitializer init, WithManaAnimationInfo info)
     : base(info)
 {
     this.info = info;
     self      = init.Self;
     wsb       = init.Self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == Info.Body);
 }
Beispiel #2
0
 public WithIdleAnimation(Actor self, WithIdleAnimationInfo info)
     : base(info)
 {
     wsb           = self.Trait <WithSpriteBody>();
     buildComplete = !self.Info.HasTraitInfo <BuildingInfo>();            // always render instantly for units
     ticks         = info.Interval;
 }
Beispiel #3
0
 public WithAttackAnimation(ActorInitializer init, WithAttackAnimationInfo info)
     : base(info)
 {
     armament = init.Self.TraitsImplementing <Armament>()
                .Single(a => a.Info.Name == Info.Armament);
     wsb = init.Self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == Info.Body);
 }
Beispiel #4
0
 public WithAttackAnimation(ActorInitializer init, WithAttackAnimationInfo info)
 {
     this.info = info;
     attack    = init.Self.Trait <AttackBase>();
     armament  = init.Self.TraitsImplementing <Armament>()
                 .Single(a => a.Info.Name == info.Armament);
     wsb = init.Self.Trait <WithSpriteBody>();
 }
Beispiel #5
0
        public WithMoveAnimation(ActorInitializer init, WithMoveAnimationInfo info)
        {
            this.info = info;
            movement  = init.Self.Trait <IMove>();
            wsb       = init.Self.Trait <WithSpriteBody>();

            cachedPosition = init.Self.CenterPosition;
        }
Beispiel #6
0
        public WithAttackAnimation(ActorInitializer init, WithAttackAnimationInfo info)
            : base(info)
        {
            attack   = init.Self.Trait <AttackBase>();
            armament = init.Self.TraitsImplementing <Armament>()
                       .Single(a => a.Info.Name == Info.Armament);
            wsb = init.Self.TraitsImplementing <WithSpriteBody>().First(w => w.Info.Name == Info.Body);

            noAimOrReloadAnim = string.IsNullOrEmpty(Info.AimSequence) && string.IsNullOrEmpty(Info.ReloadPrefix);
        }
        public WithChargeOverlay(Actor self, WithChargeOverlayInfo info)
        {
            this.info = info;
            rs        = self.Trait <RenderSprites>();
            wsb       = self.Trait <WithSpriteBody>();

            var attackCharges     = self.Trait <AttackCharges>();
            var attackChargesInfo = (AttackChargesInfo)attackCharges.Info;

            overlay = new Animation(self.World, rs.GetImage(self));
            overlay.PlayFetchIndex(wsb.NormalizeSequence(self, info.Sequence),
                                   () => int2.Lerp(0, overlay.CurrentSequence.Length, attackCharges.ChargeLevel, attackChargesInfo.ChargeLevel + 1));

            rs.Add(new AnimationWithOffset(overlay, null, () => !buildComplete, 1024),
                   info.Palette, info.IsPlayerPalette);
        }
        public WithMakeAnimation(ActorInitializer init, WithMakeAnimationInfo info)
        {
            this.info = info;
            var self = init.Self;

            wsb = self.Trait <WithSpriteBody>();

            var building = self.TraitOrDefault <Building>();

            if (building != null && !building.SkipMakeAnimation)
            {
                wsb.PlayCustomAnimation(self, info.Sequence, () =>
                {
                    building.NotifyBuildingComplete(self);
                });
            }
        }
        public WithResourceLevelOverlay(Actor self, WithResourceLevelOverlayInfo info)
            : base(info)
        {
            rs              = self.Trait <RenderSprites>();
            wsb             = self.Trait <WithSpriteBody>();
            playerResources = self.Owner.PlayerActor.Trait <PlayerResources>();

            var a = new Animation(self.World, rs.GetImage(self));

            a.PlayFetchIndex(info.Sequence, () =>
                             playerResources.ResourceCapacity != 0 ?
                             ((10 * a.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity) :
                             0);

            anim = new AnimationWithOffset(a, null, () => IsTraitDisabled, 1024);
            rs.Add(anim, info.Palette, info.IsPlayerPalette);
        }
Beispiel #10
0
        public WithResources(Actor self, WithResourcesInfo info)
        {
            this.info       = info;
            rs              = self.Trait <RenderSprites>();
            wsb             = self.Trait <WithSpriteBody>();
            playerResources = self.Owner.PlayerActor.Trait <PlayerResources>();

            var a = new Animation(self.World, rs.GetImage(self));

            a.PlayFetchIndex(info.Sequence, () =>
                             playerResources.ResourceCapacity != 0 ?
                             ((10 * a.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity) :
                             0);

            anim = new AnimationWithOffset(a, null, () => !buildComplete, 1024);
            rs.Add(anim);
        }
Beispiel #11
0
 public WithSupportPowerActivationAnimation(Actor self, WithSupportPowerActivationAnimationInfo info)
     : base(info)
 {
     wsb = self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == Info.Body);
 }
Beispiel #12
0
 public WithAimAnimation(ActorInitializer init, WithAimAnimationInfo info)
     : base(info)
 {
     attack = init.Self.Trait <AttackBase>();
     wsb    = init.Self.TraitsImplementing <WithSpriteBody>().First(w => w.Info.Name == Info.Body);
 }
Beispiel #13
0
 public WithGrowAnimation(Actor self, WithGrowAnimationInfo info)
 {
     this.info = info;
     wsb       = self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == info.Body);
 }
Beispiel #14
0
 void INotifyCreated.Created(Actor self)
 {
     wsb = self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == Info.Body);
 }
Beispiel #15
0
 public WithIdleAnimation(Actor self, WithIdleAnimationInfo info)
     : base(info)
 {
     wsb   = self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == Info.Body);
     ticks = info.Interval;
 }
Beispiel #16
0
 public WithRearmAnimation(Actor self, WithRearmAnimationInfo info)
     : base(info)
 {
     spriteBody = self.TraitOrDefault <WithSpriteBody>();
 }
Beispiel #17
0
 public WithBuildingPlacedAnimation(Actor self, WithBuildingPlacedAnimationInfo info)
 {
     this.info     = info;
     wsb           = self.Trait <WithSpriteBody>();
     buildComplete = !self.Info.HasTraitInfo <BuildingInfo>();
 }
Beispiel #18
0
 public WithMoveAnimation(ActorInitializer init, WithMoveAnimationInfo info)
     : base(info)
 {
     movement = init.Self.Trait <IMove>();
     wsb      = init.Self.TraitsImplementing <WithSpriteBody>().First(w => w.Info.Name == Info.Body);
 }
Beispiel #19
0
 public WithIdleAnimation(Actor self, WithIdleAnimationInfo info)
     : base(info)
 {
     wsb   = self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == Info.Body);
     ticks = Util.RandomDelay(self.World, info.Interval);
 }
 public WithHarvestAnimation(ActorInitializer init, WithHarvestAnimationInfo info)
 {
     Info = info;
     harv = init.Self.Trait <Harvester>();
     wsb  = init.Self.Trait <WithSpriteBody>();
 }
Beispiel #21
0
 public WithChargeAnimation(Actor self, WithChargeAnimationInfo info)
 {
     this.info     = info;
     wsb           = self.Trait <WithSpriteBody>();
     attackCharges = self.Trait <AttackCharges>();
 }
 public WithSiloAnimation(ActorInitializer init, WithSiloAnimationInfo info)
 {
     this.info       = info;
     wsb             = init.Self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == info.Body);
     playerResources = init.Self.Owner.PlayerActor.Trait <PlayerResources>();
 }
Beispiel #23
0
 public WithChargeAnimation(ActorInitializer init, WithChargeAnimationInfo info)
 {
     this.info = info;
     wsb       = init.Self.Trait <WithSpriteBody>();
 }
 public WithBuildingPlacedAnimation(Actor self, WithBuildingPlacedAnimationInfo info)
 {
     this.info     = info;
     wsb           = self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == info.Body);
     buildComplete = !self.Info.HasTraitInfo <BuildingInfo>();
 }
Beispiel #25
0
 public WithHarvestAnimation(ActorInitializer init, WithHarvestAnimationInfo info)
 {
     Info = info;
     wsb  = init.Self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == Info.Body);
 }
 public WithNukeLaunchAnimation(Actor self, WithNukeLaunchAnimationInfo info)
     : base(info)
 {
     spriteBody = self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == Info.Body);
 }
 public WithDeliveryAnimation(Actor self, WithDeliveryAnimationInfo info)
     : base(info)
 {
     wsb = self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == info.Body);
 }
Beispiel #28
0
 public WithSiloAnimation(ActorInitializer init, WithSiloAnimationInfo info)
 {
     this.info       = info;
     wsb             = init.Self.Trait <WithSpriteBody>();
     playerResources = init.Self.Owner.PlayerActor.Trait <PlayerResources>();
 }
 public WithRearmAnimation(Actor self, WithRearmAnimationInfo info)
 {
     this.info  = info;
     spriteBody = self.TraitOrDefault <WithSpriteBody>();
 }
 public WithChargeAnimation(Actor self, WithChargeAnimationInfo info)
 {
     this.info     = info;
     wsb           = self.TraitsImplementing <WithSpriteBody>().Single(w => w.Info.Name == info.Body);
     attackCharges = self.Trait <AttackCharges>();
 }