Пример #1
0
 public Field(Int32 field_width, Int32 field_height)
 {
     center = new Vector(width / 2, height / 2);
       corner_left_top = new Vector(0,0);
     corner_right_top = new Vector(width, 0);
     corner_left_bottom = new Vector(0, height);
     corner_rigth_bottom = new Vector(width, height);
        side_left_center = new Vector(0, height / 2);
       side_rigth_center = new Vector(width, height / 2);
       side_bottom_center = new Vector(width / 2, height);
        side_top_center = new Vector(width / 2, 0);
 }
Пример #2
0
 void GoTo(Vector pos)
 {
     location = pos;
 }
Пример #3
0
 void FireTo(Vector pos)
 {
     Bullet bullet = new Bullet(location, pos, firepower);
 }
Пример #4
0
 public Robot(String sdll, Vector slocation)
 {
     dll = sdll;
     location = slocation;
 }
Пример #5
0
 public Vector(Vector a)
 {
     x = a.x;
     y = a.y;
 }
Пример #6
0
 public Vector GetNormalize()
 {
     Vector vec = new Vector(this);
     vec.Normalize();
     return vec;
 }
Пример #7
0
 public bool Equals(Vector a, float epsilon)
 {
     if (Math.Abs(x - a.x) > epsilon)
         return false;
     if (Math.Abs(y - a.y) > epsilon)
         return false;
     return true;
 }
Пример #8
0
 public float Dot(Vector v)
 {
     return x * v.x + y * v.y;
 }
Пример #9
0
 public Vector Cross(Vector v)
 {
     return new Vector((y * v.x) - (x * v.y), (x * v.y) - (y * v.x));
 }
Пример #10
0
        public void Clamp(Vector min, Vector max)
        {
            if (x < min.x)
                x = min.x;
            else if (x > max.x)
                x = max.x;

            if (y < min.y)
                y = min.y;
            else if (y > max.y)
                y = max.y;
        }
Пример #11
0
 public static Vector Normalize(Vector v)
 {
     return v.GetNormalize();
 }
Пример #12
0
 public static float Dot(Vector a, Vector b)
 {
     return a.Dot(b);
 }
Пример #13
0
 public static Vector Cross(Vector a, Vector b)
 {
     return a.Cross(b);
 }