Exemplo n.º 1
0
 public bool Intersects(AABB Other)
 {
     /*
      * +---+
      * |   |
      * |  ++--+
      * |  ||  |
      * |  ++--+
      * |   |
      * +---+
      */
     Vector3 op = Other.Pos;
     return
         PointIn (op.X, op.Y, op.Z) ||
         PointIn (op.X + Other.Width, op.Y, op.Z) ||
         PointIn (op.X, op.Y + Other.Height, op.Z) ||
         PointIn (op.X, op.Y, op.Z + Other.Depth) ||
         PointIn (op.X + Other.Width, op.Y + Other.Height, op.Z) ||
         PointIn (op.X + Other.Width, op.Y, op.Z + Other.Depth) ||
         PointIn (op.X, op.Y + Other.Height, op.Z + Other.Depth) ||
         PointIn (op.X + Other.Width, op.Y + Other.Height, op.Z + Other.Depth);
 }
Exemplo n.º 2
0
 public IEntity(Vector3 Pos, AABB Bounds, int MaxHealth)
 {
     _pos = Pos;
     _bounds = Bounds;
     _vel = new Vector3 (0, 0, 0);
     _acc = new Vector3 (0, 0, 0);
     _hurtCooldown = 0;
     _health = MaxHealth;
 }