Exemplo n.º 1
0
        public MobileUnit(SerializationInfo info, StreamingContext ctx)
            : base(info, ctx)
        {
            try {
                m_aggr = (Aggressiveness)info.GetInt32("Aggressiveness");
            } catch (SerializationException) {
                m_aggr = Aggressiveness.Defender;
            }

            try {
                m_cab = (CaBase)info.GetValue("Action", typeof(CaBase));
            } catch (SerializationException) {
                m_cab = new GuardUnitAction();
            }
            Init();
        }
Exemplo n.º 2
0
        public static CaBase LoadIni(string strValue)
        {
            CaBase cab = null;
            switch (int.Parse(strValue.Split(',')[0])) {
            case 0: // knGuardUnitAction
                cab = new GuardUnitAction();
                break;

            case 1: // knGuardVicinityUnitAction
                cab = new GuardVicinityUnitAction();
                break;

            case 2: // knGuardAreaUnitAction
                cab = new GuardAreaUnitAction();
                break;

            case 3: // knMoveUnitAction
                cab = new MoveUnitAction();
                break;

            case 4: // knHuntEnemiesUnitAction
                cab = new HuntEnemiesUnitAction();
                break;

            case 5: // knMineUnitAction
                cab = new MineUnitAction();
                break;

            default:
                return null;
            }
            if (cab != null) {
                cab.FromSaveString(strValue);
            }
            return cab;
        }
Exemplo n.º 3
0
 public MobileUnit(Side side, int tx, int ty)
     : base(side, tx, ty)
 {
     m_aggr = Aggressiveness.Defender;
     m_cab = new GuardUnitAction();
 }