コード例 #1
0
 private void OnDragHandler(Vector2 dragged, Vector2 currentPosition)
 {
     var currentAngle = currentPosition.AngleWithCenterIn(Position);
     var rotation = currentAngle - _lastAngle;
     _lastAngle = currentAngle;
     Rotation = Rotation + rotation;
     if (OnRotation != null)
         OnRotation(rotation);
 }
コード例 #2
0
 private void OnStartDragHandler(Vector2 currentPosition)
 {
     _lastAngle = currentPosition.AngleWithCenterIn(Position);
     _originalRotation = Rotation;
     if (OnStartRotation != null)
         OnStartRotation(_originalRotation);
 }
コード例 #3
0
 public void AngleWithoutCenterInOriginAndPointWithSameCoordinates()
 {
     var vec = new Vector2(3.0f);
     var angle = vec.AngleWithCenterIn(new Vector2(1.0f));
     Assert.AreEqual(45.0f, angle);
 }
コード例 #4
0
 public void AngleWithCenterInOriginAndPointInYAxis()
 {
     var vec = new Vector2(0.0f, 3.0f);
     var angle = vec.AngleWithCenterIn(Vector2.Zero);
     Assert.AreEqual(90.0f, angle);
 }