CnC_Remastered_Collection

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

UnitTypes.cs (4778B)


      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.Drawing;
     18 using System.Linq;
     19 using System.Reflection;
     20 
     21 namespace MobiusEditor.TiberianDawn
     22 {
     23     public static class UnitTypes
     24     {
     25         public static readonly UnitType HTank = new UnitType(0, "htnk", "TEXT_UNIT_TITLE_GDI_MAMMOTH_TANK", "Goodguy", true);
     26         public static readonly UnitType MTank = new UnitType(1, "mtnk", "TEXT_UNIT_TITLE_GDI_MED_TANK", "Goodguy", true);
     27         public static readonly UnitType LTank = new UnitType(2, "ltnk", "TEXT_UNIT_TITLE_NOD_LIGHT_TANK", "Badguy", true);
     28         public static readonly UnitType STank = new UnitType(3, "stnk", "TEXT_UNIT_TITLE_NOD_STEALTH_TANK", "Badguy");
     29         public static readonly UnitType FTank = new UnitType(4, "ftnk", "TEXT_UNIT_TITLE_NOD_FLAME_TANK", "Badguy");
     30         public static readonly UnitType Visceroid = new UnitType(5, "vice", "TEXT_UNIT_TITLE_VICE", "Special");
     31         public static readonly UnitType APC = new UnitType(6, "apc", "TEXT_UNIT_TITLE_GDI_APC", "Goodguy");
     32         public static readonly UnitType MLRS = new UnitType(7, "msam", "TEXT_UNIT_TITLE_GDI_MRLS", "Goodguy", true);
     33         public static readonly UnitType Jeep = new UnitType(8, "jeep", "TEXT_UNIT_TITLE_GDI_HUMVEE", "Goodguy", true);
     34         public static readonly UnitType Buggy = new UnitType(9, "bggy", "TEXT_UNIT_TITLE_NOD_NOD_BUGGY", "Badguy", true);
     35         public static readonly UnitType Harvester = new UnitType(10, "harv", "TEXT_UNIT_TITLE_GDI_HARVESTER", "Goodguy");
     36         public static readonly UnitType Arty = new UnitType(11, "arty", "TEXT_UNIT_TITLE_NOD_ARTILLERY", "Badguy");
     37         public static readonly UnitType SAM = new UnitType(12, "mlrs", "TEXT_UNIT_TITLE_GDI_MLRS", "Goodguy", true);
     38         public static readonly UnitType Hover = new UnitType(13, "lst", "TEXT_UNIT_TITLE_LST", "Goodguy");
     39         public static readonly UnitType MHQ = new UnitType(14, "mhq", "TEXT_UNIT_TITLE_MHQ", "Goodguy");
     40         public static readonly UnitType GunBoat = new UnitType(15, "boat", "TEXT_UNIT_TITLE_WAKE", "Goodguy", true);
     41         public static readonly UnitType MCV = new UnitType(16, "mcv", "TEXT_UNIT_TITLE_GDI_MCV", "Goodguy");
     42         public static readonly UnitType Bike = new UnitType(17, "bike", "TEXT_UNIT_TITLE_NOD_RECON_BIKE", "Badguy");
     43         public static readonly UnitType Tric = new UnitType(18, "tric", "TEXT_UNIT_TITLE_TRIC", "Special");
     44         public static readonly UnitType Trex = new UnitType(19, "trex", "TEXT_UNIT_TITLE_TREX", "Special");
     45         public static readonly UnitType Rapt = new UnitType(20, "rapt", "TEXT_UNIT_TITLE_RAPT", "Special");
     46         public static readonly UnitType Steg = new UnitType(21, "steg", "TEXT_UNIT_TITLE_STEG", "Special");
     47 
     48         public static readonly UnitType Tran = new UnitType(0 | UnitTypeIDMask.Aircraft, "tran", "TEXT_UNIT_TITLE_GDI_TRANSPORT", "Goodguy");
     49         public static readonly UnitType A10 = new UnitType(1 | UnitTypeIDMask.Aircraft, "a10", "TEXT_UNIT_TITLE_A10", "Goodguy", false, true);
     50         public static readonly UnitType Heli = new UnitType(2 | UnitTypeIDMask.Aircraft, "heli", "TEXT_UNIT_TITLE_NOD_HELICOPTER", "Badguy");
     51         public static readonly UnitType C17 = new UnitType(3 | UnitTypeIDMask.Aircraft, "c17", "TEXT_UNIT_TITLE_C17", "Badguy", false, true);
     52         public static readonly UnitType Orca = new UnitType(4 | UnitTypeIDMask.Aircraft, "orca", "TEXT_UNIT_TITLE_GDI_ORCA", "Goodguy");
     53 
     54         private static readonly UnitType[] Types;
     55 
     56         static UnitTypes()
     57         {
     58             Types =
     59                 (from field in typeof(UnitTypes).GetFields(BindingFlags.Static | BindingFlags.Public)
     60                  where field.IsInitOnly && typeof(UnitType).IsAssignableFrom(field.FieldType)
     61                  select field.GetValue(null) as UnitType).ToArray();
     62         }
     63 
     64         public static IEnumerable<UnitType> GetTypes()
     65         {
     66             return Types;
     67         }
     68     }
     69 }