void Start() { EnterNewSuite("Angles"); Angle a = Angle.FromDegrees(20.0f); Angle b = Angle.FromDegrees(310.0f); TestEqual(Angle.GetLargerDistance(a, b).GetDegreesUnsigned(), 290.0f); TestEqual(Angle.GetSmallerDistance(b, a).GetDegreesUnsigned(), 70.0f); TestEqual(Angle.FromHeadingVector(1.0f, 0.0f).GetDegreesUnsigned(), 0.0f); TestEqual(Angle.FromHeadingVector(0.0f, 1.0f).GetDegreesUnsigned(), 90.0f); TestEqual(Angle.FromHeadingVector(-1.0f, 0.0f).GetDegreesUnsigned(), 180.0f); TestEqual(Angle.FromHeadingVector(0.0f, -1.0f).GetDegreesUnsigned(), 270.0f); Test(Angle.FromDegrees(30.0f).IsCoterminal(Angle.FromDegrees(-330.0f))); Test(Angle.FromDegrees(30.0f).IsCoterminal(Angle.FromDegrees(390.0f))); EnterNewSuite("Generics"); TestEqual(UtilGeneric.Add <int, int, int>(5, 7), 12); Vector3 start = new Vector3(1, 0, 0); Vector3 end = new Vector3(16, 0, 0); Vector3 velocity = new Vector3(5, 0, 0); TestEqual(UtilVelocity.GetVelocity(start, end, 3.0f), velocity); TestEqual(UtilVelocity.GetFuturePosition(2.0f, 3.0f, 6.0f), 20.0f); }
// When this method is called, the GameObject moves towards the destination // with a velocity to reach the destination in the given amount of seconds. public void LerpToInTime(Vector2 destination, float seconds) { this.destination = destination; velocity = UtilVelocity.GetVelocity(mover.GetPosition(), destination, seconds); lerping = true; }