protected virtual void TakesDamageTilt() { if (Game.Random.Next(2) == 0) { foreach (var v in Abilities) { v.TryEndPerform(true); } } takesDamageTilt.ClearKeys(); tilting = true; takesDamageTilt.AddKey(new Common.InterpolatorKey <float> { Time = 0.15f, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 1 }); var k = new Common.InterpolatorKey <float> { Time = 0.5f, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 0 }; k.Passing += new EventHandler((o, e2) => { tilting = false; }); takesDamageTilt.AddKey(k); }
void entity_AddedToScene(object sender, EventArgs e) { entity.Scene.View.Frame += new View.FrameEventHandler(View_Frame); if (entity.MainGraphic == null) return; hasAlphaDefault = ((MetaModel)entity.MainGraphic).HasAlpha; if (FadeinTime > 0) { fadeingIn = true; alpha.Value = 0; Common.InterpolatorKey<float> k; alpha.AddKey(k = new Common.InterpolatorKey<float> { Time = FadeinTime, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 1 }); k.Passing += new EventHandler((o, e2) => { ((MetaModel)entity.MainGraphic).HasAlpha = hasAlphaDefault; fadeingIn = false; if (entity.MainGraphic != null) ((MetaModel)entity.MainGraphic).Opacity = 1; }); ((MetaModel)entity.MainGraphic).HasAlpha = true; } else { alpha.Value = 1; if (entity.MainGraphic != null) ((MetaModel)entity.MainGraphic).Opacity = 1; } }
public void ScrollOut(Control control) { var p = popupDatas[control]; float val = 0; if (Orientation == ProgressOrientation.BottomToTop) { val = Size.Y; } float time = 1; if (TimeType == AnimationTimeType.Speed) { time = Math.Abs((p.Value.Value - val) / Time); } Common.InterpolatorKey <float> k; p.Value.ClearKeys(); p.Value.AddKey(k = new Common.InterpolatorKey <float> { Time = time, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = val }); k.Passing += new EventHandler((o, e) => { toRemove.Add(p.Control); }); p.Removing = true; Invalidate(); }
void StartFlashing() { float period = 20; flashAlpha.ClearKeys(); flashAlpha.Value = 0; var k = new Common.InterpolatorKey <float> { Period = period, Time = 1, Repeat = true, Value = 0 }; k.Passing += new EventHandler(k_Passing); flashAlpha.AddKey(k); flashAlpha.AddKey(new Common.InterpolatorKey <float> { Period = period, Time = 1.1f, Repeat = true, Value = 1 }); flashAlpha.AddKey(new Common.InterpolatorKey <float> { Period = period, Time = 1.7f, Repeat = true, Value = 0 }); }
public ExplodingZombieEffect() { VisibilityLocalBounding = new BoundingBox(new Vector3(-1, -1, -1), new Vector3(1, 1, 1)); AddChild(splatter = new Props.GroundSplatterDecal { OrientationRelation = OrientationRelation.Absolute }); Common.InterpolatorKey <float> k; opacity.Value = 1; opacity.AddKey(k = new Common.InterpolatorKey <float> { Time = 10, Value = 1 }); k.Passing += new EventHandler((o, e) => { //((MetaModel)MainGraphic).HasAlpha = true; //((MetaModel)MainGraphic).AlphaRef = 4; }); opacity.AddKey(k = new Common.InterpolatorKey <float> { Time = 15, Value = 0 }); k.Passing += new EventHandler((o, e) => Remove()); Updateable = true; }
public WarningPopupText() { Background = null; Clickable = false; Overflow = global::Graphics.TextOverflow.Ignore; Anchor = global::Graphics.Orientation.Top; TextAnchor = global::Graphics.Orientation.Center; AutoSize = AutoSizeMode.Full; Font = new Graphics.Content.Font { Backdrop = System.Drawing.Color.Black, Color = System.Drawing.Color.Red, SystemFont = Fonts.HugeSystemFont }; yInterpolator.Value = 200; Common.InterpolatorKey <float> k; yInterpolator.AddKey(k = new Common.InterpolatorKey <float> { Time = 1, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 100 }); k.Passing += new EventHandler(k_Passing); Position = new Vector2(0, yInterpolator.Value); Updateable = true; }
public void Timeout(float time, Action action) { var k = new Common.InterpolatorKey <float> { Time = time, TimeType = Common.InterpolatorKeyTimeType.Relative, }; k.Passing += new EventHandler((e, o) => action()); timeouts.AddKey(k); }
public void Fadeout() { var k = new Common.InterpolatorKey <float> { TimeType = Common.InterpolatorKeyTimeType.Relative, Time = FadeTime, Value = 0 }; k.Passing += new EventHandler((o, e) => Remove()); alpha.AddKey(k); }
protected override void OnAddedToScene() { base.OnAddedToScene(); alphaInterpolator.Value = 1; Common.InterpolatorKey <float> k; alphaInterpolator.AddKey(k = new Common.InterpolatorKey <float> { Time = DisplayTime, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 0 }); k.Passing += new EventHandler(k_Passing); }
public void Fadeout() { if (fadeingOut || entity.MainGraphic == null) return; fadeingOut = true; ((MetaModel)entity.MainGraphic).HasAlpha = true; ((MetaModel)entity.MainGraphic).AlphaRef = 0; ((MetaModel)entity.MainGraphic).CastShadows = Priority.Never; var key = new Common.InterpolatorKey<float> { Time = FadeoutTime, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 0 }; key.Passing += new EventHandler(key_Passing); alpha.AddKey(key); }
protected override void PerformingTick() { base.PerformingTick(); if (TargetUnit.State != UnitState.Alive) { TryEndPerform(true); return; } if (demonSmokeCharge == null) { Game.Instance.Scene.Add(demonSmokeCharge = new Effects.DemonSmoke1Small()); } else { TargetUnit.Hit(Performer, 50, AttackType.Ethereal, this); if (!second) { Performer.Heal(Performer, 100); } second = false; demonSmokeCharge.Stop(); demonSmokeTransport = demonSmokeCharge; demonSmokeCharge = new Client.Game.Map.Effects.DemonSmoke1Small(); Game.Instance.Scene.Add(demonSmokeCharge); transport = new Common.Interpolator3 { Value = TargetUnit.Translation }; transport.AddKey(transportKey = new Common.InterpolatorKey <Vector3> { Time = TickPeriod, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = Performer.Translation }); if (TargetUnit.State != UnitState.Alive) { new DemonLinkExplosion { Performer = Performer, Mediator = TargetUnit, TargetEntity = TargetUnit, TargetPosition = TargetUnit.Position }.TryStartPerform(); } } }
protected override void OnAddedToScene() { base.OnAddedToScene(); alphaInterpolator.Value = 1; Common.InterpolatorKey <float> k; alphaInterpolator.AddKey(k = new Common.InterpolatorKey <float> { Time = DisplayTime, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 0 }); k.Passing += new EventHandler(k_Passing); Program.Instance.SoundManager.GetSFX(Sound.SFX.Trombone1).Play(new Sound.PlayArgs { Looping = false }); }
public void Fadeout() { if (fadeingOut || entity.MainGraphic == null) { return; } fadeingOut = true; ((MetaModel)entity.MainGraphic).HasAlpha = true; ((MetaModel)entity.MainGraphic).AlphaRef = 0; ((MetaModel)entity.MainGraphic).CastShadows = Priority.Never; var key = new Common.InterpolatorKey <float> { Time = FadeoutTime, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 0 }; key.Passing += new EventHandler(key_Passing); alpha.AddKey(key); }
void entity_AddedToScene(object sender, EventArgs e) { entity.Scene.View.Frame += new View.FrameEventHandler(View_Frame); if (entity.MainGraphic == null) { return; } hasAlphaDefault = ((MetaModel)entity.MainGraphic).HasAlpha; if (FadeinTime > 0) { fadeingIn = true; alpha.Value = 0; Common.InterpolatorKey <float> k; alpha.AddKey(k = new Common.InterpolatorKey <float> { Time = FadeinTime, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 1 }); k.Passing += new EventHandler((o, e2) => { ((MetaModel)entity.MainGraphic).HasAlpha = hasAlphaDefault; fadeingIn = false; if (entity.MainGraphic != null) { ((MetaModel)entity.MainGraphic).Opacity = 1; } }); ((MetaModel)entity.MainGraphic).HasAlpha = true; } else { alpha.Value = 1; if (entity.MainGraphic != null) { ((MetaModel)entity.MainGraphic).Opacity = 1; } } }
void Minimize(bool animate) { completedYInterpolator.ClearKeys(); if (animate) { Common.InterpolatorKey <float> k; completedYInterpolator.AddKey(k = new Common.InterpolatorKey <float> { Time = 0.2f, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = -stageCompleted.Size.Y }); k.Passing += new EventHandler((o, e) => { State = StageCompletedState.Maximized; }); } else { completedYInterpolator.Value = -stageCompleted.Size.Y; } }
protected override void OnAddedToScene() { base.OnAddedToScene(); alphaInterpolator.Value = 1; Common.InterpolatorKey<float> k; alphaInterpolator.AddKey(k = new Common.InterpolatorKey<float> { Time = DisplayTime, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 0 }); k.Passing += new EventHandler(k_Passing); Program.Instance.SoundManager.GetSFX(Sound.SFX.Trombone1).Play(new Sound.PlayArgs { Looping = false }); }
void Minimize(bool animate) { completedYInterpolator.ClearKeys(); if (animate) { Common.InterpolatorKey<float> k; completedYInterpolator.AddKey(k = new Common.InterpolatorKey<float> { Time = 0.2f, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = -stageCompleted.Size.Y }); k.Passing += new EventHandler((o, e) => { State = StageCompletedState.Maximized; }); } else { completedYInterpolator.Value = -stageCompleted.Size.Y; } }
protected override void StartEffectivePerform() { base.StartEffectivePerform(); oldCamera = (Graphics.LookatCamera)Game.Instance.Camera; camera = new Graphics.LookatCartesianCamera { AspectRatio = oldCamera.AspectRatio, FOV = oldCamera.FOV, ZFar = oldCamera.ZFar }; Game.Instance.Camera = camera; position = new Common.Interpolator3(); lookat = new Common.Interpolator3(); up = new Common.Interpolator3(); if (StartCameraAngle != null) { position.Value = Game.Instance.Map.GetCameraAngle(StartCameraAngle).Position; lookat.Value = Game.Instance.Map.GetCameraAngle(StartCameraAngle).Lookat; up.Value = Game.Instance.Map.GetCameraAngle(StartCameraAngle).Up; } else { position.Value = oldCamera.Position; lookat.Value = oldCamera.Lookat; up.Value = oldCamera.Up; } var endPositionKey = new Common.InterpolatorKey<Vector3> { Time = EffectiveDuration - EndDelay, TimeType = Common.InterpolatorKeyTimeType.Relative, }; var endLookatKey = new Common.InterpolatorKey<Vector3> { Time = EffectiveDuration - EndDelay, TimeType = Common.InterpolatorKeyTimeType.Relative, }; var endUpKey = new Common.InterpolatorKey<Vector3> { Time = EffectiveDuration - EndDelay, TimeType = Common.InterpolatorKeyTimeType.Relative, }; if (EndCameraAngle != null) { endPositionKey.Value = Game.Instance.Map.GetCameraAngle(EndCameraAngle).Position; endLookatKey.Value = Game.Instance.Map.GetCameraAngle(EndCameraAngle).Lookat; endUpKey.Value = Game.Instance.Map.GetCameraAngle(EndCameraAngle).Up; } else { endPositionKey.Value = oldCamera.Position; endLookatKey.Value = oldCamera.Lookat; endUpKey.Value = oldCamera.Up; } position.AddKey(endPositionKey); lookat.AddKey(endLookatKey); up.AddKey(endUpKey); ((Graphics.SortedTestSceneRendererConnector)Game.Instance.SceneRendererConnector).ForceCull = true; ((Graphics.SortedTestSceneRendererConnector)Game.Instance.SceneRendererConnector).ForceShadowCull = true; }
public void ScrollOut(Control control) { var p = popupDatas[control]; float val = 0; if (Orientation == ProgressOrientation.BottomToTop) val = Size.Y; float time = 1; if (TimeType == AnimationTimeType.Speed) time = Math.Abs((p.Value.Value - val) / Time); Common.InterpolatorKey<float> k; p.Value.ClearKeys(); p.Value.AddKey(k = new Common.InterpolatorKey<float> { Time = time, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = val }); k.Passing += new EventHandler((o, e) => { toRemove.Add(p.Control); }); p.Removing = true; Invalidate(); }
public void Timeout(float time, Action action) { var k = new Common.InterpolatorKey<float> { Time = time, TimeType = Common.InterpolatorKeyTimeType.Relative, }; k.Passing += new EventHandler((e, o) => action()); timeouts.AddKey(k); }
protected override void PerformingTick() { base.PerformingTick(); if (TargetUnit.State != UnitState.Alive) { TryEndPerform(true); return; } if (demonSmokeCharge == null) Game.Instance.Scene.Add(demonSmokeCharge = new Effects.DemonSmoke1Small()); else { TargetUnit.Hit(Performer, 50, AttackType.Ethereal, this); if(!second) Performer.Heal(Performer, 100); second = false; demonSmokeCharge.Stop(); demonSmokeTransport = demonSmokeCharge; demonSmokeCharge = new Client.Game.Map.Effects.DemonSmoke1Small(); Game.Instance.Scene.Add(demonSmokeCharge); transport = new Common.Interpolator3 { Value = TargetUnit.Translation }; transport.AddKey(transportKey = new Common.InterpolatorKey<Vector3> { Time = TickPeriod, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = Performer.Translation }); if (TargetUnit.State != UnitState.Alive) { new DemonLinkExplosion { Performer = Performer, Mediator = TargetUnit, TargetEntity = TargetUnit, TargetPosition = TargetUnit.Position }.TryStartPerform(); } } }
public WarningPopupText() { Background = null; Clickable = false; Overflow = global::Graphics.TextOverflow.Ignore; Anchor = global::Graphics.Orientation.Top; TextAnchor = global::Graphics.Orientation.Center; AutoSize = AutoSizeMode.Full; Font = new Graphics.Content.Font { Backdrop = System.Drawing.Color.Black, Color = System.Drawing.Color.Red, SystemFont = Fonts.HugeSystemFont }; yInterpolator.Value = 200; Common.InterpolatorKey<float> k; yInterpolator.AddKey(k = new Common.InterpolatorKey<float> { Time = 1, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 100 }); k.Passing += new EventHandler(k_Passing); Position = new Vector2(0, yInterpolator.Value); Updateable = true; }
protected override void OnAddedToScene() { base.OnAddedToScene(); alphaInterpolator.Value = 1; Common.InterpolatorKey<float> k; alphaInterpolator.AddKey(k = new Common.InterpolatorKey<float> { Time = DisplayTime, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 0 }); k.Passing += new EventHandler(k_Passing); }
protected virtual void TakesDamageTilt() { if(Game.Random.Next(2) == 0) foreach (var v in Abilities) v.TryEndPerform(true); takesDamageTilt.ClearKeys(); tilting = true; takesDamageTilt.AddKey(new Common.InterpolatorKey<float> { Time = 0.15f, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 1 }); var k = new Common.InterpolatorKey<float> { Time = 0.5f, TimeType = Common.InterpolatorKeyTimeType.Relative, Value = 0 }; k.Passing += new EventHandler((o, e2) => { tilting = false; }); takesDamageTilt.AddKey(k); }
public void Fadeout() { var k = new Common.InterpolatorKey<float> { TimeType = Common.InterpolatorKeyTimeType.Relative, Time = FadeTime, Value = 0 }; k.Passing += new EventHandler((o, e) => Remove()); alpha.AddKey(k); }