예제 #1
0
파일: Bullet.cs 프로젝트: reged/RBXSolution
 public Bullet(Vector position, Vector velocity, Int32 damage)
 {
     Position = position;
     Velocity = velocity;
     Damage = damage;
     Dim = new Size(5, 5);
 }
예제 #2
0
파일: Robot.cs 프로젝트: reged/RBXSolution
 public void Build()
 {
     Alive = true;
     HP = 100;
     Dim = new Size(20, 20);
     Position = new Vector(300, 300);
     List<IRobot> Enemies = new List<IRobot>();
     calcRect();
 }
예제 #3
0
파일: Robot.cs 프로젝트: reged/RBXSolution
 public void GoTo(Vector pos)
 {
     Vector delta = pos - Position;
     float p = 0.5f;
     float length = (int)delta.Length();
     float k = length / 50;
     if (length > 0.5)
     {
         if (k < p)
         {
             k = p;
         }
         Vector velocity = (pos - Position).GetNormalize() * k;
         Position = Position + velocity;
         calcRect();
     }
 }
예제 #4
0
파일: Vector.cs 프로젝트: reged/RBXSolution
 public Vector(Vector a)
 {
     x = a.x;
     y = a.y;
 }
예제 #5
0
파일: Vector.cs 프로젝트: reged/RBXSolution
 public Vector GetNormalize()
 {
     Vector vec = new Vector(this);
     vec.Normalize();
     return vec;
 }
예제 #6
0
파일: Vector.cs 프로젝트: reged/RBXSolution
 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;
 }
예제 #7
0
파일: Vector.cs 프로젝트: reged/RBXSolution
 /*  public unsafe float this[int index]
 {
     get
     {
         if (index < 0 || index > 1)
             throw new ArgumentOutOfRangeException("index");
         fixed (float* v = &this.x)
         {
             return v[index];
         }
     }
     set
     {
         if (index < 0 || index > 1)
             throw new ArgumentOutOfRangeException("index");
         fixed (float* v = &this.x)
         {
             v[index] = value;
         }
     }
 }*/
 public float Dot(Vector v)
 {
     return x * v.x + y * v.y;
 }
예제 #8
0
파일: Vector.cs 프로젝트: reged/RBXSolution
 public Vector Cross(Vector v)
 {
     return new Vector((y * v.x) - (x * v.y), (x * v.y) - (y * v.x));
 }
예제 #9
0
파일: Vector.cs 프로젝트: reged/RBXSolution
        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;
        }
예제 #10
0
파일: Vector.cs 프로젝트: reged/RBXSolution
 public static Vector Normalize(Vector v)
 {
     return v.GetNormalize();
 }
예제 #11
0
파일: Vector.cs 프로젝트: reged/RBXSolution
 public static float Dot(Vector a, Vector b)
 {
     return a.Dot(b);
 }
예제 #12
0
파일: Vector.cs 프로젝트: reged/RBXSolution
 public static Vector Cross(Vector a, Vector b)
 {
     return a.Cross(b);
 }
예제 #13
0
파일: Robot.cs 프로젝트: reged/RBXSolution
 public void FireTo(Vector pos)
 {
     RobotEventArgs e = new RobotEventArgs();
     e.Bullet = new Bullet(Position + (pos - Position).GetNormalize() * 20, (pos - Position).GetNormalize()*50, 5);
     FireEvent(this, e);
 }