Exemple #1
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;
 }
Exemple #2
0
        public WithMoveAnimation(ActorInitializer init, WithMoveAnimationInfo info)
        {
            this.info = info;
            movement  = init.Self.Trait <IMove>();
            wsb       = init.Self.Trait <WithSpriteBody>();

            cachedPosition = init.Self.CenterPosition;
        }
Exemple #3
0
 public Refinery(Actor self, RefineryInfo info)
 {
     this.self          = self;
     this.info          = info;
     playerResources    = self.Owner.PlayerActor.Trait <PlayerResources>();
     currentDisplayTick = info.TickRate;
     wsb = self.Trait <WithSpriteBody>();
 }
 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>();
 }
Exemple #5
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);
        }
Exemple #6
0
        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);
                });
            }
        }
Exemple #7
0
 public WithSiloAnimation(ActorInitializer init, WithSiloAnimationInfo info)
 {
     this.info       = info;
     wsb             = init.Self.Trait <WithSpriteBody>();
     playerResources = init.Self.Owner.PlayerActor.Trait <PlayerResources>();
 }
 public WithHarvestAnimation(ActorInitializer init, WithHarvestAnimationInfo info)
 {
     Info = info;
     harv = init.Self.Trait <Harvester>();
     wsb  = init.Self.Trait <WithSpriteBody>();
 }
Exemple #9
0
 public WithBuildingPlacedAnimation(Actor self, WithBuildingPlacedAnimationInfo info)
 {
     this.info     = info;
     wsb           = self.Trait <WithSpriteBody>();
     buildComplete = !self.Info.HasTraitInfo <BuildingInfo>();
 }
Exemple #10
0
 public WithChargeAnimation(ActorInitializer init, WithChargeAnimationInfo info)
 {
     this.info = info;
     wsb       = init.Self.Trait <WithSpriteBody>();
 }
Exemple #11
0
 public WithActiveAnimation(Actor self, WithActiveAnimationInfo info)
 {
     wsb       = self.Trait <WithSpriteBody>();
     this.info = info;
 }