Exemplo n.º 1
0
 public void BuildingComplete(Actor self)
 {
     wsb.DefaultAnimation.PlayFetchIndex(wsb.NormalizeSequence(self, info.Sequence),
                                         () => playerResources.ResourceCapacity != 0
                         ? ((info.Stages * wsb.DefaultAnimation.CurrentSequence.Length - 1) * playerResources.Resources) / (info.Stages * playerResources.ResourceCapacity)
                                 : 0);
 }
        public void Tick(Actor self)
        {
            var baseSequence = wsb.NormalizeSequence(self, wsb.Info.Sequence);
            var sequence     = NormalizeHarvesterSequence(self, baseSequence);

            if (!IsModifying && wsb.DefaultAnimation.HasSequence(sequence) && wsb.DefaultAnimation.CurrentSequence.Name != sequence)
            {
                wsb.DefaultAnimation.ReplaceAnim(sequence);
            }
        }
Exemplo n.º 3
0
 void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
 {
     if (anim.Animation.CurrentSequence != null)
     {
         anim.Animation.ReplaceAnim(wsb.NormalizeSequence(self, info.Sequence));
     }
 }
Exemplo n.º 4
0
        void INotifyBuildComplete.BuildingComplete(Actor self)
        {
            var attackChargesInfo = (AttackChargesInfo)attackCharges.Info;

            wsb.DefaultAnimation.PlayFetchIndex(wsb.NormalizeSequence(self, info.Sequence),
                                                () => int2.Lerp(0, wsb.DefaultAnimation.CurrentSequence.Length, attackCharges.ChargeLevel, attackChargesInfo.ChargeLevel + 1));
        }
Exemplo n.º 5
0
        protected override void TraitEnabled(Actor self)
        {
            var attackChargesInfo = (AttackChargesInfo)attackCharges.Info;

            wsb.DefaultAnimation.PlayFetchIndex(wsb.NormalizeSequence(self, Info.Sequence),
                                                () => int2.Lerp(0, wsb.DefaultAnimation.CurrentSequence.Length, attackCharges.ChargeLevel, attackChargesInfo.ChargeLevel + 1));
        }
Exemplo n.º 6
0
 void PlayAnimation(Actor self)
 {
     wsb.DefaultAnimation.PlayFetchIndex(wsb.NormalizeSequence(self, Info.Sequence),
                                         () => playerResources.ResourceCapacity != 0
                                 ? ((Info.Stages * wsb.DefaultAnimation.CurrentSequence.Length - 1) * playerResources.Resources) / (Info.Stages * playerResources.ResourceCapacity)
                                 : 0);
 }
Exemplo n.º 7
0
        void INotifyHarvesterAction.Harvested(Actor self, ResourceType resource)
        {
            var sequence = wsb.NormalizeSequence(self, Info.HarvestSequence);

            if (wsb.DefaultAnimation.HasSequence(sequence) && wsb.DefaultAnimation.CurrentSequence.Name != sequence)
            {
                wsb.PlayCustomAnimation(self, sequence);
            }
        }
        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);
        }