DirectionTypes.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // The Command & Conquer Map Editor and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // The Command & Conquer Map Editor and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. using MobiusEditor.Model;
  15. using System.Collections.Generic;
  16. using System.Linq;
  17. using System.Reflection;
  18. namespace MobiusEditor.RedAlert
  19. {
  20. public static class DirectionTypes
  21. {
  22. public static readonly DirectionType North = new DirectionType(0, "North", FacingType.North);
  23. public static readonly DirectionType NorthNorthEast = new DirectionType(16, "North-NorthEast");
  24. public static readonly DirectionType NorthEast = new DirectionType(32, "NorthEast", FacingType.NorthEast);
  25. public static readonly DirectionType EastNorthEast = new DirectionType(48, "East-NorthEast");
  26. public static readonly DirectionType East = new DirectionType(64, "East", FacingType.East);
  27. public static readonly DirectionType EastSouthEast = new DirectionType(80, "East-SouthEast");
  28. public static readonly DirectionType SouthEast = new DirectionType(96, "SouthEast", FacingType.SouthEast);
  29. public static readonly DirectionType SouthSouthEast = new DirectionType(112, "South-SouthEast");
  30. public static readonly DirectionType South = new DirectionType(128, "South", FacingType.South);
  31. public static readonly DirectionType SouthSouthWest = new DirectionType(144, "South-SouthWest");
  32. public static readonly DirectionType SouthWest = new DirectionType(160, "SouthWest", FacingType.SouthWest);
  33. public static readonly DirectionType WestSouthWest = new DirectionType(176, "West-SouthWest");
  34. public static readonly DirectionType West = new DirectionType(192, "West", FacingType.West);
  35. public static readonly DirectionType WestNorthWest = new DirectionType(208, "West-NorthWest");
  36. public static readonly DirectionType NorthWest = new DirectionType(224, "NorthWest", FacingType.NorthWest);
  37. public static readonly DirectionType NorthNorthWest = new DirectionType(240, "North-NorthWest");
  38. private static DirectionType[] Types;
  39. static DirectionTypes()
  40. {
  41. Types =
  42. (from field in typeof(DirectionTypes).GetFields(BindingFlags.Static | BindingFlags.Public)
  43. where field.IsInitOnly && typeof(DirectionType).IsAssignableFrom(field.FieldType)
  44. select field.GetValue(null) as DirectionType).ToArray();
  45. }
  46. public static IEnumerable<DirectionType> GetTypes()
  47. {
  48. return Types;
  49. }
  50. }
  51. }