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


C# Animation.Move方法代码示例

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


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

示例1: 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

示例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 = 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


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