protected override VisibleAnimationObjectKeyFrame CopyAsVisibleAnimationObjectKeyFrame(AnimationClass.AnimationLayer ActiveLayer) { ENKeyFrame NewAnimatedBitmapKeyFrame = new ENKeyFrame(); NewAnimatedBitmapKeyFrame.UpdateFrom(this); NewAnimatedBitmapKeyFrame._EN = _EN; return(NewAnimatedBitmapKeyFrame); }
public void ComputeRealDamage(ENKeyFrame KeyFrame) { ENOld = ENCurrent; ENCurrent = ComputeDamage(KeyFrame); ENNext = 0; TextSize = fntDamage.MeasureString("EN-" + ENCurrent.ToString()); }
public override void UpdateAnimationObject(int KeyFrame) { Progress = 0; //An Event is being executed. if (NextEvent != null) { Progress = (KeyFrame - EventKeyFrameOld) / (float)(NextEventKeyFrame - EventKeyFrameOld); ENCurrent = ENOld + (int)(ENChangeValue * Progress); if (Owner != null) { Owner.ConsumeEN((int)ENChangeValue); } UpdateAnimationSprite(KeyFrame); } ENKeyFrame ActiveKeyFrame; VisibleAnimationObjectKeyFrame ActiveAnimationSpriteKeyFrame; if (DicAnimationKeyFrame.TryGetValue(KeyFrame, out ActiveAnimationSpriteKeyFrame)) { ActiveKeyFrame = (ENKeyFrame)ActiveAnimationSpriteKeyFrame; //If that animation has already been used, skip it. if (ActiveKeyFrame.IsUsed) { return; } int NextKeyFrame = ActiveKeyFrame.NextKeyFrame; OnNewKeyFrameAnimationSprite(ActiveKeyFrame); ComputeRealDamage(ActiveKeyFrame); if (DicAnimationKeyFrame.TryGetValue(NextKeyFrame, out ActiveAnimationSpriteKeyFrame)) { ENKeyFrame NextActiveKeyFrame = (ENKeyFrame)ActiveAnimationSpriteKeyFrame; if (NextActiveKeyFrame.IsProgressive) { OnProgressiveNextKeyFrameAnimationSprite(NextActiveKeyFrame, KeyFrame, NextKeyFrame); ComputeNextDamage(NextActiveKeyFrame); } else { NextEvent = null; } } else if (Owner != null && (!ActiveKeyFrame.IsProgressive || KeyFrame == SpawnFrame)) { Owner.ConsumeEN(ENCurrent); } } }
private int ComputeDamage(ENKeyFrame KeyFrame) { int DamageDealt = GetDamageFromText(KeyFrame.Damage); string[] DamageSplit = KeyFrame.Damage.Split('/'); if (DamageSplit.Length == 1) { return(DamageDealt); } else if (DamageSplit.Length == 2) { return((int)(DamageDealt / Convert.ToDouble(DamageSplit[1], System.Globalization.CultureInfo.InvariantCulture))); } return(0); }
private ENTimeline(BinaryReader BR, ContentManager Content) : base(BR, TimelineType) { _SpawnFrame = BR.ReadInt32(); _DeathFrame = BR.ReadInt32(); fntDamage = Content.Load <SpriteFont>("Fonts/Finlander Font"); int DicAnimationSpriteKeyFrameCount = BR.ReadInt32(); for (int E = 0; E < DicAnimationSpriteKeyFrameCount; E++) { int Key = BR.ReadInt32(); ENKeyFrame NewAnimatedBitmapKeyFrame = new ENKeyFrame(BR); DicAnimationKeyFrame.Add(Key, NewAnimatedBitmapKeyFrame); } }
public void ComputeNextDamage(ENKeyFrame KeyFrame) { ENNext = ComputeDamage(KeyFrame); TextSize = fntDamage.MeasureString("EN-" + ENNext.ToString()); int DamageDifference = ENNext - ENCurrent; ENChangeValue = DamageDifference; string DamageString = ENNext.ToString(); RoundTrip = new int[Math.Max(DamageString.Length, ENCurrent.ToString().Length)]; for (int i = DamageString.Length - 1; i >= 0; --i) { if (DamageDifference > 0) { RoundTrip[i] = DamageDifference; DamageDifference /= 10; } else { RoundTrip[i] = 0; } } }