YAPOG  0.0.1
Yet Another Pokemon Online Game
DynamicWorldObjectReader.cpp
Go to the documentation of this file.
8 
9 namespace yap
10 {
12  "maxVelocity";
13 
15  DynamicWorldObject& dynamicWorldObject,
16  const String& xmlRootNodeName)
17  : WorldObjectReader (dynamicWorldObject, xmlRootNodeName)
18  , dynamicWorldObject_ (dynamicWorldObject)
19  {
20  }
21 
23  {
24  }
25 
27  {
28  WorldObjectReader::Visit (visitable);
29 
30  auto reader = visitable.ChangeRoot (xmlRootNodeName_);
31 
32  if (reader->NodeExists (DEFAULT_XML_MAX_VELOCITY_NODE_NAME))
34  reader->ReadVector2 (
36  else
39 
40  PhysicsCore* physicsCore = new ForceToVelocityPhysicsCore ();
41  physicsCore->SetVelocityBounds (
42  Vector2 (),
44 
45  dynamicWorldObject_.SetPhysicsCore (physicsCore);
46 
47  if (!reader->NodeExists ("events"))
48  return;
49 
50  auto boundingBoxesReader = reader->ChangeRoot ("events");
51 
52  XmlReaderCollection boundingBoxReaders;
53  boundingBoxesReader->ReadNodes ("entry", boundingBoxReaders);
54  for (auto& xmlBoundingBoxReader : boundingBoxReaders)
55  {
56  BoundingBox* boundingBox = new BoundingBox ();
57  BoundingBoxReader boundingBoxReader (*boundingBox, "BoundingBox");
58  xmlBoundingBoxReader->Accept (boundingBoxReader);
59 
61  }
62  }
63 } // namespace yap