Esempio n. 1
0
        private List <CombatMicro> GetMicro(Unit unit)
        {
            CombatMicro micro;

            if (unit.UnitType == UnitTypes.MEDIVAC)
            {
                micro = new MedivacHealClosest();
            }
            else if (unit.UnitType == UnitTypes.SIEGE_TANK_SIEGED)
            {
                micro = new AttackClosestSiegeTank();
            }
            else
            {
                micro = new AttackClosest();
            }

            return(new List <CombatMicro>()
            {
                micro
            });
        }
Esempio n. 2
0
        private static CombatUnit CreateUnit(uint unitType, bool player1Owned, float x, int health, int shield, int energy, int energyMax, bool isFlying, HashSet <uint> upgrades)
        {
            Tag++;
            Unit unit = new Unit();

            unit.Owner = player1Owned ? (int)Bot.Main.PlayerId : (3 - (int)Bot.Main.PlayerId);
            unit.Pos   = new SC2APIProtocol.Point()
            {
                X = x
            };
            unit.Health    = health;
            unit.HealthMax = health;
            unit.Shield    = shield;
            unit.ShieldMax = shield;
            unit.Energy    = energy;
            unit.EnergyMax = energyMax;
            unit.UnitType  = unitType;
            unit.Tag       = Tag;
            unit.IsFlying  = isFlying;
            CombatMicro.CombatMicro micro;
            if (unit.UnitType == UnitTypes.MEDIVAC)
            {
                micro = new MedivacHealClosest();
            }
            else if (unit.UnitType == UnitTypes.SIEGE_TANK_SIEGED)
            {
                micro = new AttackClosestSiegeTank();
            }
            else
            {
                micro = new AttackClosest();
            }
            CombatUnit result = SimulationUtil.FromUnit(unit, micro, upgrades);

            return(result);
        }