Example #1
0
        public Unit(SC2APIProtocol.Unit unit)
        {
            this.original     = unit;
            this.unitTypeData = ControllerDefault.gameData.Units[(int)unit.UnitType];

            this.name            = unitTypeData.Name;
            this.tag             = unit.Tag;
            this.unitType        = unit.UnitType;
            this.position        = new Vector3(unit.Pos.X, unit.Pos.Y, unit.Pos.Z);
            this.integrity       = (unit.Health + unit.Shield) / (unit.HealthMax + unit.ShieldMax);
            this.buildProgress   = unit.BuildProgress;
            this.idealWorkers    = unit.IdealHarvesters;
            this.assignedWorkers = unit.AssignedHarvesters;

            this.order     = unit.Orders.Count > 0 ? unit.Orders[0] : new UnitOrder();
            this.orders    = unit.Orders;
            this.isVisible = (unit.DisplayType == DisplayType.Visible);

            this.supply = (int)unitTypeData.FoodRequired;

            this.vespene  = unit.VespeneContents;
            this.minerals = unit.MineralContents;
            this.sight    = this.unitTypeData.SightRange;
            this.target   = unit.EngagedTargetTag;
        }
        public Unit(SC2APIProtocol.Unit unit, UnitTypeData unitTypeData)
        {
            this.Original     = unit;
            this.UnitTypeData = unitTypeData;

            this.Name            = UnitTypeData.Name;
            this.Tag             = unit.Tag;
            this.UnitType        = unit.UnitType;
            this.Position        = new Vector3(unit.Pos.X, unit.Pos.Y, unit.Pos.Z);
            this.Integrity       = (unit.Health + unit.Shield) / (unit.HealthMax + unit.ShieldMax);
            this.BuildProgress   = unit.BuildProgress;
            this.IdealWorkers    = unit.IdealHarvesters;
            this.AssignedWorkers = unit.AssignedHarvesters;

            this.Order     = unit.Orders.Count > 0 ? unit.Orders[0] : new UnitOrder();
            this.Orders    = unit.Orders;
            this.IsVisible = (unit.DisplayType == DisplayType.Visible);

            this.Supply     = (int)UnitTypeData.FoodRequired;
            this.Energy     = (int)unit.Energy;
            this.Energy     = (int)unit.EnergyMax;
            this.IsInjected = unit.BuffIds.Contains(Buffs.QUEENSPAWNLARVATIMER);
            this.Alliance   = unit.Alliance;
        }
Example #3
0
        public Unit(SC2APIProtocol.Unit original)
        {
            this.original = original;
            this.position = new Vector3(original.Pos.X, original.Pos.Y, original.Pos.Z);

            this.tag                = original.Tag;
            this.order              = (original.Orders.Count > 0) ? new Order(original.Orders[0]) : new Order();
            this.orderCount         = original.Orders.Count;
            this.buildProgress      = original.BuildProgress;
            this.unitType           = original.UnitType;
            this.health             = original.Health;
            this.shield             = original.Shield;
            this.integrity          = (original.Health + original.Shield) / (original.HealthMax + original.ShieldMax);
            this.assignedHarvesters = original.AssignedHarvesters;
            this.idealHarvesters    = original.IdealHarvesters;
            this.addOnTag           = original.AddOnTag;
            this.owner              = original.Owner;
            this.energy             = original.Energy;
            this.radius             = original.Radius;
            this.weaponCooldown     = original.WeaponCooldown;
            this.radarRange         = original.RadarRange;
            this.detectRange        = original.DetectRange;
            this.cloak              = original.Cloak;
            this.isFlying           = original.IsFlying;
            this.buffs              = new List <uint>(original.BuffIds);
            this.vespeneContents    = original.VespeneContents;
            this.passengers         = original.Passengers.ToList();
            this.usedSupply         = 1;
            this.airAttackRange     = 0;
            this.groundAttackRange  = 1;
            this.displayType        = original.DisplayType;
            this.isBlip             = original.IsBlip;

            if (unitType == Units.REAPER)
            {
                groundAttackRange = 5;
            }
            else if (unitType == Units.MARINE)
            {
                groundAttackRange = 5;
                airAttackRange    = 5;
            }
            else if (unitType == Units.BANSHEE)
            {
                groundAttackRange = 6;
                usedSupply        = 3;
            }
            else if (Units.SiegeTanks.Contains(unitType))
            {
                groundAttackRange = 13;
                usedSupply        = 3;
            }
            else if (Units.Vikings.Contains(unitType))
            {
                airAttackRange = 9;
                usedSupply     = 2;
            }
            else if (unitType == Units.ROACH)
            {
                groundAttackRange = 4;
            }
            else if (unitType == Units.QUEEN)
            {
                groundAttackRange = 5;
                airAttackRange    = 8;
            }
            else if (unitType == Units.HYDRALISK)
            {
                groundAttackRange = 5;
                airAttackRange    = 5;
            }
            else if (unitType == Units.STALKER)
            {
                groundAttackRange = 6;
                airAttackRange    = 6;
            }
            else if (unitType == Units.SENTRY)
            {
                groundAttackRange = 5;
                airAttackRange    = 5;
            }
            else if (unitType == Units.ADEPT)
            {
                groundAttackRange = 4;
            }
            else if (unitType == Units.SPORE_CRAWLER)
            {
                airAttackRange = 7;
            }
            else if (unitType == Units.MISSILE_TURRET)
            {
                airAttackRange = 7;
            }
            else if (unitType == Units.BUNKER)
            {
                airAttackRange    = 6;
                groundAttackRange = 6;
            }
            else if (unitType == Units.PHOTON_CANNON)
            {
                airAttackRange    = 7;
                groundAttackRange = 7;
            }
        }
Example #4
0
 public void Update(Unit unit)
 {
     Unit = unit;
 }
Example #5
0
 public Agent(SC2APIProtocol.Unit unit)
 {
     this.Unit = unit;
 }
Example #6
0
 public void Update(SC2APIProtocol.Unit unit)
 {
 }