public void SetDestination(Vector2 destination) { destination -= this.position; Vector2 direction = destination.Normalized(); currentLength = Math.Min(maxLength, destination.Length); Point2 = direction * currentLength; // update the angle between the rope and the up vector (if required) if (!angleSet) { angle = (float)Math.Acos(Vector2.Dot(new Vector2(0, 1), Point2.Normalized())); angleSet = true; } }
public void StartMoving(Vector2 dir) { if (float.IsNaN(dir.X) || float.IsNaN(dir.Y)) { return; } if (Movement == null || !Health.IsAlive) return; if (!Anim.Playing || !Movement.IsMoving || Anim.CurAnim != WalkAnim) Anim.Start(WalkAnim); _moveDir = dir.Normalized(); Anim.Speed = MoveSpeed; }