当前位置: 首页>>代码示例>>C#>>正文


C# Scene.AddAnimation方法代码示例

本文整理汇总了C#中Scene.AddAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.AddAnimation方法的具体用法?C# Scene.AddAnimation怎么用?C# Scene.AddAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scene的用法示例。


在下文中一共展示了Scene.AddAnimation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createMagic

 void createMagic(Sprite caster, Scene scene, MagicArgs args, int count, double angle, double width)
 {
     Animation magic = new Animation() { Code = args.Code, Coordinate = args.Coordinate, Z = args.Z };
     EventHandler handler = null;
     magic.Disposed += handler = delegate {
         magic.Disposed -= handler;
         scene.RemoveAnimation(magic);
     };
     scene.AddAnimation(magic);
     double radian = Global.GetRadian(angle);
     double x = width * Math.Cos(radian) + magic.Coordinate.X;
     double y = width * Math.Sin(radian) + magic.Coordinate.Y;
     magic.Coordinate = new Point(x, y);
     //捕获圆范围内将要伤害的精灵表
     for (int i = 0; i < scene.sprites.Count; i++) {
         if (scene.sprites[i].IsVisible && caster.IsHostileTo(scene.sprites[i].Camp)) {
             if (scene.sprites[i].InCircle(Scene.GetGameCoordinate(magic.Coordinate), args.Radius)) {
                 Targets.Add(scene.sprites[i]);
             }
         }
     }
     //对精灵表中所有精灵进行魔法/技能伤害
     foreach (Sprite sprite in Targets) {
         caster.CastingToHurt(sprite, args);
     }
     Targets.Clear();
 }
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:27,代码来源:LinearWaveMagic.cs

示例2: Run

 public override void Run(Sprite caster, Scene scene, MagicArgs args)
 {
     double angle = Global.GetAngle(Global.GetRadian(Scene.GetWindowCoordinate(caster.Coordinate), args.Target)) + 180;
     double singleAngle = 360 / args.Number;
     for (int i = 0; i < args.Number; i++) {
         Animation magic = new Animation() { Code = args.Code, Coordinate = args.Coordinate, Z = args.Z };
         EventHandler handler = null;
         magic.Disposed += handler = delegate {
             magic.Disposed -= handler;
             magic.Dispose();
             scene.RemoveAnimation(magic);
         };
         scene.AddAnimation(magic);
         magic.RenderTransform = new RotateTransform() {
             CenterX = magic.Center.X,
             CenterY = magic.Center.Y,
             Angle = angle + singleAngle * i
         };
     }
     //捕获十字(圆)范围内将要伤害的精灵表
     for (int i = 0; i < scene.sprites.Count; i++) {
         if (scene.sprites[i].IsVisible && caster.IsHostileTo(scene.sprites[i].Camp)) {
             if (scene.sprites[i].InCircle(Scene.GetGameCoordinate(args.Coordinate), args.Radius)) {
                 Targets.Add(scene.sprites[i]);
             }
         }
     }
     //对精灵表中所有精灵进行魔法/技能伤害
     foreach (Sprite sprite in Targets) {
         caster.CastingToHurt(sprite, args);
     }
     Targets.Clear();
 }
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:33,代码来源:CrossMagic.cs

示例3: Run

 public override void Run(Sprite caster, Scene scene, MagicArgs args)
 {
     Animation magic = new Animation() { Code = args.Code, Coordinate = args.Coordinate, Z = args.Z };
     EventHandler handler = null;
     magic.Disposed += handler = delegate {
         magic.Disposed -= handler;
         scene.RemoveAnimation(magic);
     };
     scene.AddAnimation(magic);
     Animation animation = new Animation() { Code = 11, Coordinate = args.Coordinate };
     EventHandler animationHandler = null;
     animation.Disposed += animationHandler = delegate {
         animation.Disposed -= animationHandler;
         scene.RemoveAnimation(animation);
     };
     scene.AddAnimation(animation);
     //捕获圆范围内将要伤害的精灵表
     for (int i = 0; i < scene.sprites.Count; i++) {
         if (scene.sprites[i].IsVisible && caster.IsHostileTo(scene.sprites[i].Camp)) {
             if (scene.sprites[i].InCircle(Scene.GetGameCoordinate(args.Coordinate), args.Radius)) {
                 Targets.Add(scene.sprites[i]);
             }
         }
     }
     int count = 0;
     int number = args.Number;
     EventHandler timerHandler = null;
     DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(350) };
     timer.Tick += timerHandler = delegate {
         if (count == args.Number) {
             timer.Tick -= timerHandler;
             timer.Stop();
             Targets.Clear();
         } else {
             count++;
             if (count > 1) {
                 args.SpecialEffect = SpecialEffects.None;
                 scene.Shake(15, 10);
             }
             //对精灵表中所有精灵进行魔法/技能伤害
             foreach (Sprite sprite in Targets) {
                 caster.CastingToHurt(sprite, args);
             }
         }
     };
     timer.Start();
 }
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:47,代码来源:MultipleHitCircleMagic.cs

示例4: Run

 public override void Run(Sprite caster, Scene scene, MagicArgs args)
 {
     double angle = Global.GetAngle(Global.GetRadian(Scene.GetWindowCoordinate(caster.Coordinate), args.Target)) + 180;
     Point p0 = new Point(args.Coordinate.X, args.Coordinate.Y - 20);
     Point p1 = new Point(args.Coordinate.X + args.Radius * Math.Cos(Global.GetRadian(angle)), args.Coordinate.Y + args.Radius * Math.Sin(Global.GetRadian(angle)));
     int count = 0;
     int number = args.Number;
     EventHandler handler = null;
     DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(80) };
     timer.Tick += handler = delegate {
         if (count == args.Number - 1) {
             timer.Tick -= handler;
             timer.Stop();
         } else {
             count++;
             Animation magic = new Animation() { Code = args.Code, Coordinate = args.Coordinate, Z = args.Z };
             EventHandler otherHandler = null;
             magic.Disposed += otherHandler = delegate {
                 magic.Disposed -= otherHandler;
                 scene.RemoveAnimation(magic);
             };
             scene.AddAnimation(magic);
             magic.RenderTransform = new RotateTransform() {
                 CenterX = magic.Center.X,
                 CenterY = magic.Center.Y,
                 Angle = angle
             };
             EventHandler moveHandler = null;
             magic.MoveCompleted += moveHandler = delegate {
                 magic.MoveCompleted -= moveHandler;
                 magic.Dispose();
             };
             magic.Move(p0, p1, 1, MoveModes.Normal);
         }
     };
     timer.Start();
     //捕获多边形范围内将要伤害的精灵表
     for (int i = 0; i < scene.sprites.Count; i++) {
         if (scene.sprites[i].IsVisible && caster.IsHostileTo(scene.sprites[i].Camp)) {
             if (scene.sprites[i].InPolygon(Global.GetRectRange(angle, p0, p1, args.Radius / 10))) {
                 Targets.Add(scene.sprites[i]);
             }
         }
     }
     //对精灵表中所有精灵进行魔法/技能伤害
     foreach (Sprite sprite in Targets) {
         caster.CastingToHurt(sprite, args);
     }
     Targets.Clear();
 }
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:50,代码来源:LinearShuttleMagic.cs

示例5: Run

 public override void Run(Sprite caster, Scene scene, MagicArgs args)
 {
     double angle = Global.GetAngle(Global.GetRadian(Scene.GetWindowCoordinate(caster.Coordinate), args.Target)) + 180;
     double singleAngle = 18;
     double startAngle = angle - ((args.Number - 1) / 2 * singleAngle);
     double endAngle = angle + ((args.Number - 1) / 2 * singleAngle);
     for (int i = 0; i < args.Number; i++) {
         double otherAngle = startAngle + singleAngle * i;
         Animation magic = new Animation() { Code = args.Code, Coordinate = args.Coordinate, Z = args.Z };
         EventHandler magicHandler = null;
         magic.Disposed += magicHandler = delegate {
             magic.Disposed -= magicHandler;
             scene.RemoveAnimation(magic);
         };
         scene.AddAnimation(magic);
         Point p = new Point(args.Coordinate.X + args.Radius * Math.Cos(Global.GetRadian(otherAngle)), args.Coordinate.Y + args.Radius * Math.Sin(Global.GetRadian(otherAngle)));
         EventHandler moveHandler = null;
         magic.MoveCompleted += moveHandler = delegate {
             magic.MoveCompleted -= moveHandler;
             magic.Dispose();
         };
         magic.Move(magic.Coordinate, p, 1.3, MoveModes.Normal);
     }
     double s0 = 0, s1 = 1, e0 = 0, e1 = 0;
     if (startAngle < 180 && endAngle > 180) {
         s0 = startAngle; e0 = 180; s1 = -180; e1 = endAngle - 360;
     } else if (startAngle >= 180) {
         s0 = startAngle - 360; e0 = endAngle - 360;
     } else {
         s0 = startAngle; e0 = endAngle;
     }
     for (int i = 0; i < scene.sprites.Count; i++) {
         if (scene.sprites[i].IsVisible && caster.IsHostileTo(scene.sprites[i].Camp)) {
             double spriteAngle = Global.GetAngle(Global.GetRadian(Scene.GetWindowCoordinate(scene.sprites[i].Coordinate), args.Coordinate));
             if ((spriteAngle >= s0 && spriteAngle <= e0) || (spriteAngle >= s1 && spriteAngle <= e1)) {
                 Targets.Add(scene.sprites[i]);
             }
         }
     }
     //对精灵表中所有精灵进行魔法/技能伤害
     foreach (Sprite sprite in Targets) {
         caster.CastingToHurt(sprite, args);
     }
     Targets.Clear();
 }
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:45,代码来源:SectorMagic.cs

示例6: Run

 public override void Run(Sprite caster, Scene scene, MagicArgs args)
 {
     Animation magic = new Animation() { Code = args.Code, Coordinate = args.Coordinate, Z = args.Z };
     EventHandler handler = null;
     magic.Disposed += handler = delegate {
         magic.Disposed -= handler;
         scene.RemoveAnimation(magic);
     };
     scene.AddAnimation(magic);
     scene.Wave(args.Coordinate);
     for (int i = 0; i < scene.sprites.Count; i++) {
         if (scene.sprites[i].IsVisible && caster.IsHostileTo(scene.sprites[i].Camp)) {
             if (scene.sprites[i].InCircle(Scene.GetGameCoordinate(args.Coordinate), args.Radius)) {
                 Targets.Add(scene.sprites[i]);
             }
         }
     }
     //对精灵表中所有精灵进行魔法/技能伤害
     foreach (Sprite sprite in Targets) {
         caster.CastingToHurt(sprite, args);
     }
     Targets.Clear();
 }
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:23,代码来源:CircleMagic.cs


注:本文中的Scene.AddAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。