DungeonCollisionSettings.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace DunGen.Collision
  5. {
  6. /// <summary>
  7. /// Used to add custom collision detection when deciding where to place tiles
  8. /// </summary>
  9. /// <param name="tileBounds">The tile bounds to check collisions for</param>
  10. /// <param name="isCollidingWithDungeon">If the tile is already deemed to be colliding the dungeon itself</param>
  11. /// <returns>True if the new tile bounds are blocked</returns>
  12. public delegate bool AdditionalCollisionsPredicate(Bounds tileBounds, bool isCollidingWithDungeon);
  13. [Serializable]
  14. public class DungeonCollisionSettings
  15. {
  16. /// <summary>
  17. /// If true, tiles will not be allowed to overhang other tiles
  18. /// </summary>
  19. public bool DisallowOverhangs = false;
  20. /// <summary>
  21. /// The maximum amount of overlap allowed between two connected tiles
  22. /// </summary>
  23. public float OverlapThreshold = 0.01f;
  24. /// <summary>
  25. /// The amount of padding to add to the bounds of each tile when checking for collisions
  26. /// </summary>
  27. public float Padding = 0.0f;
  28. /// <summary>
  29. /// An optional additional set of bounds to test against when determining if a tile will collide or not.
  30. /// Useful for preventing the dungeon from being generated in specific areas
  31. /// </summary>
  32. public readonly List<Bounds> AdditionalCollisionBounds = new List<Bounds>();
  33. /// <summary>
  34. /// If true, the dungeon will avoid collisions with other dungeons
  35. /// </summary>
  36. public bool AvoidCollisionsWithOtherDungeons = false;
  37. /// <summary>
  38. /// An optional predicate to test for additional collisions
  39. /// </summary>
  40. public AdditionalCollisionsPredicate AdditionalCollisionsPredicate;
  41. }
  42. }