public override void Removed(EventArgs e) { base.Removed(e); if (tw != null && chopper != null) { tw_TweenComplete(chopper, tw); } tw = null; chopper = null; }
private void StartChopper() { if (tw == null) { //chopper.Rotation = 90; int chopperX = rnd.Next((int)ClientSize.X); int destX = rnd.Next((int)ClientSize.X); int chopperY = (int)ClientSize.Y + 400; int destY = -400; if (rnd.Next(2) == 0) { destY = chopperY; chopperY = -400; } float rot = (float)(Math.Atan2(destY - chopperY, destX - chopperX) + Math.PI / 2f); chopper = (Sprite)CreateInstanceAt("chopper", "chopper", chopperX, chopperY, rot, 500); tw = chopper.AnimateTo(new V2DRuntime.Tween.TweenState(new Vector2(destX, destY), rot, this.Scale, this.Alpha, this.CurChildFrame), 5000); tw.TweenComplete += new V2DRuntime.Display.TweenEvent(tw_TweenComplete); chopper.PlayAll(); } }