public Car Clone() { _car = new Car { Id = Id, Name = Name, MaxSpeed = MaxSpeed, CurrentSpeed = CurrentSpeed, StepSpeed = StepSpeed, BackSpeed = BackSpeed, BoostSpeed = BoostSpeed, MaxBoostCharge = MaxBoostCharge, CurentBoostCharge = CurentBoostCharge, RotateRightSpeed = RotateRightSpeed, RotateLeftSpeed = RotateLeftSpeed, CoverDistance = CoverDistance, AnimationDefault = AnimationDefault.Clone(), AnimationBack = AnimationBack.Clone(), AnimationRotateRight = AnimationRotateRight.Clone(), AnimationRotateLeft = AnimationRotateLeft.Clone(), AnimationBreaking = AnimationBreaking.Clone(), AnimationStop = AnimationStop.Clone() }; return(_car); }
protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); Animation.Stop(); AnimationBack.Start(); //Reset stopwatch sw.Reset(); sw.Stop(); sw.Start(); }
protected override void OnMouseEnter(EventArgs e) { base.OnMouseEnter(e); DrawString = true; AnimationBack.Stop(); Animation.Start(); //Reset stopwatch sw.Reset(); sw.Stop(); sw.Start(); }
/// <summary> /// Triggered every AnimationBack tick /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonAnimationBack(object sender, EventArgs e) { if (UseSmoothSpeedIncrement) { incremental_x -= Convert.ToInt32(BackgroundSpeed * sw.Elapsed.TotalSeconds * SmoothCorrectionFactor); } else { incremental_x -= BackgroundSpeed; } if (incremental_x <= 0) { AnimationBack.Stop(); incremental_x = 1; } this.Invalidate(); }