GeneratorTemplate.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "GeneratorTemplate.h"
  2. GeneratorTemplate::GeneratorTemplate()
  3. : ReferenceCounter(),
  4. propability(0.f)
  5. {}
  6. void GeneratorTemplate::setMinPosOffset(Framework::Vec3<int> minPosOffset)
  7. {
  8. this->minPosOffset = minPosOffset;
  9. }
  10. void GeneratorTemplate::setMaxSize(Framework::Vec3<int> maxSize)
  11. {
  12. this->maxSize = maxSize;
  13. }
  14. void GeneratorTemplate::setPropability(float propability)
  15. {
  16. this->propability = propability;
  17. }
  18. bool GeneratorTemplate::canEffect(
  19. Framework::Vec3<int> location, Framework::Vec3<int> affectedLocation) const
  20. {
  21. Framework::Vec3<int> localPos
  22. = affectedLocation - (location + minPosOffset);
  23. return localPos.x >= 0 && localPos.y >= 0 && localPos.z >= 0
  24. && localPos.x < maxSize.x && localPos.y < maxSize.y
  25. && localPos.z < maxSize.z;
  26. }
  27. float GeneratorTemplate::getPropability() const
  28. {
  29. return propability;
  30. }
  31. Framework::Vec3<int> GeneratorTemplate::getMinAffectedOffset() const
  32. {
  33. return minPosOffset;
  34. }
  35. Framework::Vec3<int> GeneratorTemplate::getMaxAffectedOffset() const
  36. {
  37. return minPosOffset + maxSize;
  38. }