public WithChargeOverlay(ActorInitializer init, WithChargeOverlayInfo info) { this.info = info; renderSprites = init.Self.Trait <RenderSprites>(); overlay = new Animation(init.World, renderSprites.GetImage(init.Self)); renderSprites.Add(new AnimationWithOffset(overlay, null, () => !charging), info.Palette, info.IsPlayerPalette); }
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); }