本文整理汇总了C#中Animation.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Animation.Dispose方法的具体用法?C# Animation.Dispose怎么用?C# Animation.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animation
的用法示例。
在下文中一共展示了Animation.Dispose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
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();
}
示例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;
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();
}
示例3: 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();
}