private void UpdateRotation(double diffRotation) { var centerPoint = new Point(CenterPointX, CenterPointY); var endpoint = RotatePoint(new Point(EndPointX, EndPointY), centerPoint, diffRotation); EndPointX = endpoint.X; EndPointY = endpoint.Y; _lsidePoint = RotatePoint(_lsidePoint, centerPoint, diffRotation); _rsidePoint = RotatePoint(_rsidePoint, centerPoint, diffRotation); BoneShape.Points = new PointCollection { centerPoint, _lsidePoint, endpoint, _rsidePoint }; if (ChildCollection != null && ChildCollection.Any()) { centerPoint = new Point(PosX + CenterPointX, PosY + CenterPointY); foreach (var child in ChildCollection) { if (child is Bone) { (child as Bone).UpdateChildRotation(centerPoint, diffRotation); } else if (child is Texture2D) { var tex = child as Texture2D; var newPos = RotatePoint(new Point(tex.PosX + tex.CenterPointX, tex.PosY + tex.CenterPointY), centerPoint, diffRotation); tex.PosX = newPos.X - tex.CenterPointX; tex.PosY = newPos.Y - tex.CenterPointY; tex.Rotation += diffRotation; } } } }
public void UpdateChildPositions(double diffX, double diffY) { if (IsChild) { _posX += diffX; _posY += diffY; OnPropertyChanged("PosX"); OnPropertyChanged("PosY"); } if (ChildCollection != null && ChildCollection.Any()) { foreach (var child in ChildCollection) { if (child is Bone) { (child as Bone).UpdateChildPositions(diffX, diffY); } else if (child is Texture2D) { var tex = child as Texture2D; tex.PosX += diffX; tex.PosY += diffY; } } } }
private void HandleBumper() { if ((hostMode.Value || startOfFramePacketsGenerationEnable.Value) && ChildCollection.Any()) { bumper.Start(); } else { bumper.Stop(); } }