YAPOG  0.0.1
Yet Another Pokemon Online Game
PhysicsBoundingBoxCollection.cpp
Go to the documentation of this file.
6 
7 namespace yap
8 {
11  , parent_ (nullptr)
12  {
13  }
14 
16  {
17  }
18 
20  const PhysicsBoundingBoxCollection& copy)
21  : BoundingBoxCollection (copy)
22  , parent_ (nullptr)
23  {
24  for (BoundingBox* boundingBox : copy.GetBoundingBoxes ())
25  AddPhysicsBoundingBox (new BoundingBox (*boundingBox));
26  }
27 
29  BoundingBox* boundingBox)
30  {
31  AddBoundingBox (boundingBox);
32  }
33 
35  BoundingBox* boundingBox)
36  {
37  RemoveBoundingBox (boundingBox);
38  }
39 
41  const WorldObject& parent,
42  CollidableArea* collidableArea)
43  {
44  parent_ = &parent;
45 
47  }
48 
50  const CollidableArea& collidableArea,
51  const Vector2& offset) const
52  {
53  for (BoundingBox* boundingBox : GetBoundingBoxes ())
54  if (collidableArea.CollidesWith (*boundingBox, offset, *parent_))
55  return true;
56 
57  return false;
58  }
59 
61  BoundingBox* boundingBox)
62  {
64  boundingBox,
66  new MapCollidableInfo (
67  *boundingBox,
68  *parent_)));
69  }
70 
71  void
73  BoundingBox* boundingBox)
74  {
76  }
77 } // namespace yap