Пример #1
0
 /// <summary>
 /// Create a game object
 /// </summary>
 /// <param name="team">team of the game object</param>
 /// <param name="coords">pixels coordinates of the game object</param>
 public GameObject(Team team, Vector2D coords)
 {
     this.Team   = GameException.RequireNonNull(team);
     this.Coords = GameException.RequireNonNull(coords);
 }
Пример #2
0
 /// <summary>
 ///   (a.x, a.y) * (b.x, b.y) = (a.x * b.x, a.y * b.y)
 /// </summary>
 /// <param name="a">a vector</param>
 /// <param name="b">a vector</param>
 /// <returns> A new vector </returns>
 public static Vector2D operator *(Vector2D a, double b)
 {
     GameException.RequireNonNull(a);
     return(new Vector2D(a.X * b, a.Y * b));
 }
Пример #3
0
 /// <summary>
 ///   - (a.x, a.y) = (-a.x, -a.y)
 /// </summary>
 /// <param name="a">a vector</param>
 /// <returns> A new vector </returns>
 public static Vector2D operator -(Vector2D a)
 {
     GameException.RequireNonNull(a);
     return(new Vector2D(-a.X, -a.Y));
 }
Пример #4
0
 /// <summary>
 ///   (a.x, a.y) - (b.x, b.y) = (a.x - b.x, a.y - b.y)
 /// </summary>
 /// <param name="a">a vector</param>
 /// <param name="b">a vector</param>
 /// <returns> A new vector </returns>
 public static Vector2D operator -(Vector2D a, Vector2D b)
 {
     GameException.RequireNonNull(a);
     GameException.RequireNonNull(b);
     return(new Vector2D(a.X - b.X, a.Y - b.Y));
 }
Пример #5
0
 /// <summary>
 ///   (a.x, a.y) / (b.x, b.y) = (a.x / b.x, a.y / b.y)
 /// </summary>
 /// <param name="a">a vector</param>
 /// <param name="b">a vector</param>
 /// <returns> A new vector </returns>
 public static Vector2D operator /(Vector2D a, double b)
 {
     GameException.RequireNonNull(a);
     GameException.RequireNonZero(b);
     return(new Vector2D(a.X / b, a.Y / b));
 }
Пример #6
0
 /// <summary>
 ///   a * (b.x, b.y) = (a * b.x, a * b.y)
 /// </summary>
 /// <param name="a">a double</param>
 /// <param name="b">a vector</param>
 /// <returns> A new vector </returns>
 public static Vector2D operator *(double a, Vector2D b)
 {
     return(GameException.RequireNonNull(b) * a);
 }