示例#1
0
 public UnitsForm(SimulatorManager SM, TypesEnums.UnitSide S, TypesEnums.UnitType T)
 {
     InitializeComponent();
     PrimalSimulator = SM;
     Side            = S;
     Type            = T;
     Init();
     PrimalSimulator.ConsoleBox.WriteLineToConsole("UnitForm READY! Mode: CREATE");
 }
示例#2
0
 public UnitsForm(SimulatorManager SM, TypesEnums.UnitSide S, IUnit U)
 {
     InitializeComponent();
     PrimalSimulator = SM;
     Side            = S;
     Type            = (TypesEnums.UnitType)U.UnitType;
     Init();
     EditableUnit = U;
     SelectDefPos = U.MyDefPosition;
     if (SelectDefPos != null)
     {
         l_position.Text    = SelectDefPos.ToShortString();
         l_leader.Text      = SelectDefPos.getLeader();
         chbox_hold.Checked = true;
     }
     txt_name.Text = U.UnitName;
     PrimalSimulator.ConsoleBox.WriteLineToConsole("UnitForm READY! Mode: EDIT");
     btn_ok.Text = "Edit unit";
 }
示例#3
0
        public IUnit CreateUnit(TypesEnums.UnitSide S, TypesEnums.UnitType T)
        {
            IUnit U = null;

            if (T == TypesEnums.UnitType.Infantry)
            {
                U = new UnitInfantry(NextID, (char)TypesEnums.UnitType.Infantry, TypesEnums.UnitType.Infantry);
            }
            if (T == TypesEnums.UnitType.Archers)
            {
                U = new UnitArchers(NextID, (char)TypesEnums.UnitType.Archers, TypesEnums.UnitType.Archers);
            }
            if (T == TypesEnums.UnitType.Cavalerly)
            {
                U = new UnitCavalerly(NextID, (char)TypesEnums.UnitType.Cavalerly, TypesEnums.UnitType.Cavalerly);
            }

            if (U == null)
            {
                throw new Exception("Error: Null IUnit object!");
            }

            if (S == TypesEnums.UnitSide.Ally)
            {
                Ally.Add(U);
            }
            else
            {
                Enemy.Add(U);
            }

            U.MyLand        = LandManager.ActualLandLand;
            U.MyWeather     = LandManager.ActualWeather;
            U.MyDefPosition = null;
            ConsoleBox.WriteLineToConsole("New Unit CREATE!");
            return(U);
        }
示例#4
0
 public UnitArchers(int id, char M, TypesEnums.UnitType T)
 {
     ID   = id;
     Mark = M;
     Type = T;
 }
示例#5
0
 public UnitCavalerly(int id, char M, TypesEnums.UnitType T)
 {
     ID   = id;
     Mark = M;
     Type = T;
 }