GeneratorTemplate.cpp 933 B

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