CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

DirectionTypes.cs (3242B)


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