Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 //[Server]
 void Awake()
 {
     pCommmon = GetComponent<PlayerCommon>();
     DemoMgr.singleton.AddPlayerOnline();
     pCommmon.SetPlayerId(DemoMgr.GetPlayerOnline());
     pCommmon.SetTeam(((2 - (DemoMgr.GetPlayerOnline() %2) )) );
 }
Ejemplo n.º 2
0
 //[Server]
 void Awake()
 {
     pCommmon = GetComponent <PlayerCommon>();
     DemoMgr.singleton.AddPlayerOnline();
     pCommmon.SetPlayerId(DemoMgr.GetPlayerOnline());
     pCommmon.SetTeam(((2 - (DemoMgr.GetPlayerOnline() % 2))));
 }
Ejemplo n.º 3
0
        public bool HasResouce(int mineral, int gas = 0, int food = 0)
        {
            PlayerCommon common = newObservation.Observation.PlayerCommon;

            if ((common.Minerals >= mineral) &&
                (common.Vespene >= gas) &&
                (GetAvailableSupplyRoom() >= food)
                )
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
        public int GetAvailableSupplyRoom()
        {
            PlayerCommon common = newObservation.Observation.PlayerCommon;

            return((int)(common.FoodCap - common.FoodUsed));
        }
Ejemplo n.º 5
0
 void Awake()
 {
     pCommmon = GetComponent<PlayerCommon>();
 }
Ejemplo n.º 6
0
 void Awake()
 {
     pCommmon = GetComponent <PlayerCommon>();
 }
Ejemplo n.º 7
0
 public Ressources(PlayerCommon common)
 {
     Minerals = common.Minerals;
     Vespene  = common.Vespene;
     Supply   = common.FoodCap - common.FoodUsed;
 }
Ejemplo n.º 8
0
        public IntelResponse BundleIntel(IntelRequest request)
        {
            AbathurMap map = null;

            if (request.Map)
            {
                map = new AbathurMap {
                }
            }
            ;
            Score score = null;

            if (request.Score)
            {
                score = _intel.CurrentScore;
            }
            PlayerCommon playerCommon = null;

            if (request.Common)
            {
                playerCommon = _intel.Common;
            }
            ICollection <UpgradeData> upgradeSelf = null;

            if (request.UpgradesSelf)
            {
                upgradeSelf = _intel.UpgradesSelf;
            }
            ICollection <IUnit> alliedBuilding = null;

            if (request.BuildingsSelf)
            {
                alliedBuilding = _intel.StructuresSelf().ToList();
            }
            ICollection <IUnit> alliedWorkers = null;

            if (request.WorkersSelf)
            {
                alliedWorkers = _intel.WorkersSelf().ToList();
            }
            ICollection <IUnit> alliedUnits = null;

            if (request.WorkersSelf)
            {
                alliedUnits = _intel.UnitsSelf().ToList();
            }
            ICollection <IUnit> structuresEnemy = null;

            if (request.StructuresEnemy)
            {
                structuresEnemy = _intel.WorkersEnemy().ToList();
            }
            ICollection <IUnit> unitsEnemy = null;

            if (request.UnitsEnemy)
            {
                unitsEnemy = _intel.WorkersEnemy().ToList();
            }
            ICollection <IUnit> workersEnemy = null;

            if (request.WorkersEnemy)
            {
                workersEnemy = _intel.WorkersEnemy().ToList();
            }
            IColony primaryColony = null;

            if (request.PrimaryColony)
            {
                primaryColony = _intel.PrimaryColony;
            }
            IEnumerable <IColony> colonies = null;

            if (request.Colonies)
            {
                colonies = _intel.Colonies;
            }
            ICollection <IUnit> mineralFields = null;

            if (request.MineralFields)
            {
                mineralFields = _intel.MineralFields.ToList();
            }
            ICollection <IUnit> vespeneGeysers = null;

            if (request.VespeneGeysers)
            {
                vespeneGeysers = _intel.VespeneGeysers.ToList();
            }
            ICollection <IUnit> destructibles = null;

            if (request.Destructibles)
            {
                destructibles = _intel.Destructibles().ToList();
            }
            ICollection <UnitTypeData> productionQueue = null;

            if (request.ProductionQueue)
            {
                productionQueue = _intel.ProductionQueue.ToList();
            }
            IEnumerable <Squad> squads = null;

            if (request.Squads)
            {
                squads = _squadRepo.Get();
            }
            uint gameloop = 0;

            if (request.GameLoop)
            {
                gameloop = _intel.GameLoop;
            }

            return(new IntelResponse {
                Map = map,
                Score = score,
                Common = playerCommon,
                UpgradesSelf = { upgradeSelf },
                BuildingsSelf = { Convert(alliedBuilding) },
                WorkersSelf = { Convert(alliedWorkers) },
                UnitsSelf = { Convert(alliedUnits) },
                StructuresEnemy = { Convert(structuresEnemy) },
                WorkersEnemy = { Convert(workersEnemy) },
                UnitsEnemy = { Convert(unitsEnemy) },
                PrimaryColony = Convert(primaryColony),
                Colonies = { Convert(colonies.ToList()) },
                MineralFields = { Convert(mineralFields) },
                VespeneGeysers = { Convert(vespeneGeysers) },
                Destructibles = { Convert(destructibles) },
                ProductionQueue = { productionQueue },
                Squads = { squads.Select(Convert) },
                GameLoop = gameloop
            });
        }