Пример #1
0
    static void init()
    {
        BuildingBuilder window = (BuildingBuilder)EditorWindow.GetWindow(typeof(BuildingBuilder));

        window.Show();
        //window.linemat = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Line.mat");
    }
Пример #2
0
 public void SpawnBuildings(OSMapInfo mapInfo)
 {
     foreach (OSMWay building in mapInfo.Buildings)
     {
         BuildingBuilder.CreateBuilding(building, mapInfo, BuildingMaterial);
     }
 }
Пример #3
0
 public void Construct(BuildingBuilder buildingBuilder)
 {
     buildingBuilder.BuildDoors();
     buildingBuilder.BuildFloors();
     buildingBuilder.BuildWindows();
     buildingBuilder.Paint();
 }
Пример #4
0
 public void SpawnParkingLotMarkers(OSMapInfo mapInfo)
 {
     foreach (OSMWay parkSpace in mapInfo.ParkSpaces)
     {
         BuildingBuilder.CreateBuilding(parkSpace, mapInfo, ParkingSpaceMaterial);
     }
 }
Пример #5
0
        public WorldBuilder(UnitBuilder uBuilder, BuildingBuilder bBuilder, UnityViewFactory viewFac, InventoryDatabase inventoryDatabase)
        {
            this.uBuilder = uBuilder;

            this.bBuilder          = bBuilder;
            this.viewFac           = viewFac;
            this.inventoryDatabase = inventoryDatabase;
        }
Пример #6
0
    private void Awake()
    {
        Instance        = this;
        buildingPrefabs = new Dictionary <BuildingType, GameObject>();
        buildingPrefabs.Add(BuildingType.powerPlant, Resources.Load <GameObject>("Buildings/powerPlant"));
        buildingPrefabs.Add(BuildingType.apartment, Resources.Load <GameObject>("Buildings/apartment"));
        buildingPrefabs.Add(BuildingType.castle, Resources.Load <GameObject>("Buildings/castle"));
        buildingPrefabs.Add(BuildingType.shooter, Resources.Load <GameObject>("Buildings/shooter"));

        buildCost = new Dictionary <BuildingType, PlayerDataRequire[]>();
        foreach (SerializeDict dict in buildCostSer)
        {
            buildCost.Add(dict.buildingType, dict.costs);
        }
    }
Пример #7
0
    public void Show()
    {
        int idx = 0;

        foreach (BuildingBuilder.BuildingType buildingType in BuildingBuilder.GetInstance().buildingCanBuild)
        {
            buttons[idx].gameObject.SetActive(true);
            buttonImg[idx].sprite = buildingTypeSprite[buildingType];
            if (buildingType == BuildingBuilder.BuildingType.back)
            {
                buttons[idx].onClick.AddListener(() => { LandPanel.GetInstance().ToBack(); });
            }
            else
            {
                buttons[idx].onClick.AddListener(() => {
                    BuildingBuilder.GetInstance().Build(buildingType);
                    LandPanel.GetInstance().HideAll();
                });
            }
            idx++;
        }
        gameObject.SetActive(true);
    }
Пример #8
0
	void Start ()
    {
        view = camera.pixelRect;
        mainGUI = GUIScript.main.GetComponent<GUIScript>();
	    buildingBuilder = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent<BuildingBuilder>();

        buttonSIDEstyle.fontSize = buttonStyle.fontSize = (int)((float)buttonStyle.fontSize * ScaleX);
        guiStyle.fontSize = (int)((float)guiStyle.fontSize * ScaleX);
        guiSIDEstyle.fontSize = (int)((float)guiSIDEstyle.fontSize * ScaleX);
        guiStyle.border.left = (int)(-1.62f * ScaleX);
        guiStyle.border.right = (int)(-3.25f * ScaleX);
        guiStyle.border.top = (int)(20.5f * ScaleY);
        guiStyle.border.bottom = (int)(20.5f * ScaleY);
        guiStyle.padding.top = (int)(-15f*ScaleX);
        guiStyle.padding.left = (int)(23.79f * ScaleX);
        guiStyle.overflow.top = (int)(-6.3f * ScaleY);
        guiStyle.overflow.bottom = (int)(9.5 * ScaleY);

        buttonSIDEstyle.fixedWidth *= ScaleX;
        buttonSIDEstyle.fixedHeight *= ScaleY;

        //UnitPosition = new Vector2(GUIScript.ScreenSize.x - 100, 130);
	}
Пример #9
0
    void Start()
    {
        view            = camera.pixelRect;
        mainGUI         = GUIScript.main.GetComponent <GUIScript>();
        buildingBuilder = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <BuildingBuilder>();

        buttonSIDEstyle.fontSize = buttonStyle.fontSize = (int)((float)buttonStyle.fontSize * ScaleX);
        guiStyle.fontSize        = (int)((float)guiStyle.fontSize * ScaleX);
        guiSIDEstyle.fontSize    = (int)((float)guiSIDEstyle.fontSize * ScaleX);
        guiStyle.border.left     = (int)(-1.62f * ScaleX);
        guiStyle.border.right    = (int)(-3.25f * ScaleX);
        guiStyle.border.top      = (int)(20.5f * ScaleY);
        guiStyle.border.bottom   = (int)(20.5f * ScaleY);
        guiStyle.padding.top     = (int)(-15f * ScaleX);
        guiStyle.padding.left    = (int)(23.79f * ScaleX);
        guiStyle.overflow.top    = (int)(-6.3f * ScaleY);
        guiStyle.overflow.bottom = (int)(9.5 * ScaleY);

        buttonSIDEstyle.fixedWidth  *= ScaleX;
        buttonSIDEstyle.fixedHeight *= ScaleY;

        //UnitPosition = new Vector2(GUIScript.ScreenSize.x - 100, 130);
    }
Пример #10
0
 // Use this for initialization
 private void Start()
 {
     _builder = GameObject.Find("Building").GetComponent <BuildingBuilder>();
 }
Пример #11
0
 // Use this for initialization
 private void Start()
 {
     _builder = GameObject.Find("Building").GetComponent <BuildingBuilder>();
     _camera  = GameObject.FindGameObjectWithTag("MainCamera").transform;
 }
    void Start()
    {
        city = new GameObject("City");

        float cityscapeQS = 50;

        float hc = cityscapeQS / -2.0f * cellSize;

        int built = 0;

        Material[] windowMaterials = new Material[rgbTextures.Length];
        for (int i = 0; i < rgbTextures.Length; i++)
        {
            Material m = new Material(Shader.Find("Self-Illumin/Diffuse"));

            m.SetTexture("_MainTex", rgbTextures[i]);

            Texture2D rit = randomIllumTex(rgbTextures[i].width, rgbTextures[i].height);
            //m.SetTexture("_BumpMap", rit);

            m.SetTextureScale("_MainTex", new Vector2(64, 64));
            //m.SetTextureScale("_BumpMap", new Vector2(1,1));

            windowMaterials[i] = m;
        }

        for (int s = 0; s < cityscapeQS; s++)
        {
            for (int a = 0; a < cityscapeQS; a++)
            {
                Color c = plan.GetPixelBilinear(s / cityscapeQS, a / cityscapeQS);
                if (c.r < 0.05f)
                {
                    continue;
                }

                float xp = cellSize * s + cellSize / 2 * (s / 5);
                float yp = cellSize * a + cellSize / 2 * (a / 5);

                GameObject b = (GameObject)GameObject.Instantiate(buildingPrefab, new Vector3(hc + xp, 0, hc + yp), Quaternion.identity);
                b.name             = "Building_" + s + "x" + a;
                b.transform.parent = city.transform;

                BuildingBuilder bt = (BuildingBuilder)b.GetComponent(typeof(BuildingBuilder));

                int tx = (int)Mathf.Floor(Random.value * rgbTextures.Length);

                bt.Build(
                    (int)(c.r * maxBuildingHeight),
                    (int)(Random.value * 6 + 6),
                    (int)(Random.value * 6 + 6),
                    new Vector3(0, 0, 0),
                    windowMaterials[tx]
                    );

                built++;
            }
        }

        city.transform.localScale = new Vector3(10, 10, 10);
        //CombineChildren ch = (CombineChildren) city.AddComponent<CombineChildren>();
        //ch.generateTriangleStrips = false;
    }
Пример #13
0
        public DefaultSharkyBot(GameConnection gameConnection)
        {
            var debug = false;

#if DEBUG
            debug = true;
#endif

            var framesPerSecond = 22.4f;

            SharkyOptions = new SharkyOptions {
                Debug = debug, FramesPerSecond = framesPerSecond, TagsEnabled = true
            };
            MacroData  = new MacroData();
            AttackData = new AttackData {
                ArmyFoodAttack = 30, ArmyFoodRetreat = 25, Attacking = false, UseAttackDataManager = true, CustomAttackFunction = true, RetreatTrigger = 1f, AttackTrigger = 1.5f
            };
            TargetingData = new TargetingData {
                HiddenEnemyBase = false
            };
            BaseData       = new BaseData();
            ActiveChatData = new ActiveChatData();
            EnemyData      = new EnemyData();
            SharkyUnitData = new SharkyUnitData();

            UnitDataService = new UnitDataService(SharkyUnitData);

            Managers = new List <IManager>();

            DebugService = new DebugService(SharkyOptions);
            DebugManager = new DebugManager(gameConnection, SharkyOptions, DebugService);
            Managers.Add(DebugManager);

            UpgradeDataService  = new UpgradeDataService();
            BuildingDataService = new BuildingDataService();
            TrainingDataService = new TrainingDataService();
            AddOnDataService    = new AddOnDataService();
            MorphDataService    = new MorphDataService();
            WallDataService     = new WallDataService();

            UnitDataManager = new UnitDataManager(UpgradeDataService, BuildingDataService, TrainingDataService, AddOnDataService, MorphDataService, SharkyUnitData);
            Managers.Add(UnitDataManager);

            MapData               = new MapData();
            MapDataService        = new MapDataService(MapData);
            AreaService           = new AreaService(MapDataService);
            TargetPriorityService = new TargetPriorityService(SharkyUnitData);
            CollisionCalculator   = new CollisionCalculator();
            ActiveUnitData        = new ActiveUnitData();
            UnitCountService      = new UnitCountService(ActiveUnitData, SharkyUnitData);
            DamageService         = new DamageService();

            UnitManager = new UnitManager(ActiveUnitData, SharkyUnitData, SharkyOptions, TargetPriorityService, CollisionCalculator, MapDataService, DebugService, DamageService, UnitDataService);
            MapManager  = new MapManager(MapData, ActiveUnitData, SharkyOptions, SharkyUnitData, DebugService, WallDataService);
            Managers.Add(MapManager);
            Managers.Add(UnitManager);

            EnemyRaceManager = new EnemyRaceManager(ActiveUnitData, SharkyUnitData, EnemyData);
            Managers.Add(EnemyRaceManager);

            SharkyPathFinder         = new SharkyPathFinder(new Roy_T.AStar.Paths.PathFinder(), MapData, MapDataService, DebugService);
            SharkySimplePathFinder   = new SharkySimplePathFinder(MapDataService);
            SharkyAdvancedPathFinder = new SharkyAdvancedPathFinder(new Roy_T.AStar.Paths.PathFinder(), MapData, MapDataService, DebugService);
            NoPathFinder             = new SharkyNoPathFinder();
            BuildingService          = new BuildingService(MapData, ActiveUnitData, TargetingData, BaseData);
            ChokePointService        = new ChokePointService(SharkyPathFinder, MapDataService, BuildingService);
            ChokePointsService       = new ChokePointsService(SharkyPathFinder, ChokePointService);

            BaseManager = new BaseManager(SharkyUnitData, ActiveUnitData, SharkyPathFinder, UnitCountService, BaseData);
            Managers.Add(BaseManager);

            TargetingManager = new TargetingManager(SharkyUnitData, BaseData, MacroData, TargetingData, MapData, ChokePointService, ChokePointsService, DebugService);
            Managers.Add(TargetingManager);

            BuildOptions = new BuildOptions {
                StrictGasCount = false, StrictSupplyCount = false, StrictWorkerCount = false
            };
            MacroSetup       = new MacroSetup();
            WallOffPlacement = new HardCodedWallOffPlacement(ActiveUnitData, SharkyUnitData, DebugService, MapData, BuildingService, TargetingData, BaseData);
            //WallOffPlacement = new WallOffPlacement(ActiveUnitData, SharkyUnitData, DebugService, MapData, BuildingService, TargetingData);
            ProtossBuildingPlacement = new ProtossBuildingPlacement(ActiveUnitData, SharkyUnitData, DebugService, MapDataService, BuildingService, WallOffPlacement);
            TerranBuildingPlacement  = new TerranBuildingPlacement(ActiveUnitData, SharkyUnitData, DebugService, BuildingService);
            ZergBuildingPlacement    = new ZergBuildingPlacement(ActiveUnitData, SharkyUnitData, DebugService, BuildingService);
            BuildingPlacement        = new BuildingPlacement(ProtossBuildingPlacement, TerranBuildingPlacement, ZergBuildingPlacement, BaseData, ActiveUnitData, BuildingService, SharkyUnitData);
            BuildingBuilder          = new BuildingBuilder(ActiveUnitData, TargetingData, BuildingPlacement, SharkyUnitData, BaseData);

            WarpInPlacement = new WarpInPlacement(ActiveUnitData, DebugService, MapData);

            Morpher             = new Morpher(ActiveUnitData);
            BuildPylonService   = new BuildPylonService(MacroData, BuildingBuilder, SharkyUnitData, ActiveUnitData, BaseData, TargetingData, BuildingService);
            BuildDefenseService = new BuildDefenseService(MacroData, BuildingBuilder, SharkyUnitData, ActiveUnitData, BaseData, TargetingData, BuildOptions);

            ChronoData   = new ChronoData();
            NexusManager = new NexusManager(ActiveUnitData, SharkyUnitData, ChronoData);
            Managers.Add(NexusManager);
            ShieldBatteryManager = new ShieldBatteryManager(ActiveUnitData);
            Managers.Add(ShieldBatteryManager);
            PhotonCannonManager = new PhotonCannonManager(ActiveUnitData);
            Managers.Add(PhotonCannonManager);

            OrbitalManager = new OrbitalManager(ActiveUnitData, BaseData, EnemyData);
            Managers.Add(OrbitalManager);

            HttpClient         = new HttpClient();
            ChatHistory        = new ChatHistory();
            ChatDataService    = new ChatDataService();
            EnemyNameService   = new EnemyNameService();
            EnemyPlayerService = new EnemyPlayerService(EnemyNameService);
            ChatService        = new ChatService(ChatDataService, SharkyOptions, ActiveChatData);
            ChatManager        = new ChatManager(HttpClient, ChatHistory, SharkyOptions, ChatDataService, EnemyPlayerService, EnemyNameService, ChatService, ActiveChatData);
            Managers.Add((IManager)ChatManager);

            ProxyLocationService = new ProxyLocationService(BaseData, TargetingData, SharkyPathFinder, MapDataService, AreaService);

            var individualMicroController = new IndividualMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);

            var adeptMicroController           = new AdeptMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var adeptShadeMicroController      = new AdeptShadeMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var archonMicroController          = new ArchonMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.AttackForward, false);
            var colossusMicroController        = new ColossusMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false, CollisionCalculator);
            var darkTemplarMicroController     = new DarkTemplarMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var disruptorMicroController       = new DisruptorMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var disruptorPhasedMicroController = new DisruptorPhasedMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.AttackForward, false);
            var highTemplarMicroController     = new HighTemplarMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var mothershipMicroController      = new MothershipMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var oracleMicroController          = new OracleMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var observerMicroController        = new ObserverMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var phoenixMicroController         = new PhoenixMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, true);
            var sentryMicroController          = new SentryMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.StayOutOfRange, true);
            var stalkerMicroController         = new StalkerMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var tempestMicroController         = new TempestMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var voidrayMicroController         = new VoidRayMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var carrierMicroController         = new CarrierMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var warpPrismpMicroController      = new WarpPrismMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var zealotMicroController          = new ZealotMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.AttackForward, false);

            var zerglingMicroController = new ZerglingMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.AttackForward, false);

            var marineMicroController  = new MarineMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var reaperMicroController  = new ReaperMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var bansheeMicroController = new BansheeMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);

            var workerDefenseMicroController    = new IndividualMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false, 3);
            var workerProxyScoutMicroController = new WorkerScoutMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.AttackForward, false);

            var oracleHarassMicroController = new OracleMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);
            var reaperHarassMicroController = new ReaperMicroController(MapDataService, SharkyUnitData, ActiveUnitData, DebugService, SharkyAdvancedPathFinder, BaseData, SharkyOptions, DamageService, UnitDataService, TargetingData, MicroPriority.LiveAndAttack, false);

            var individualMicroControllers = new Dictionary <UnitTypes, IIndividualMicroController>
            {
                { UnitTypes.PROTOSS_ADEPT, adeptMicroController },
                { UnitTypes.PROTOSS_ADEPTPHASESHIFT, adeptShadeMicroController },
                { UnitTypes.PROTOSS_ARCHON, archonMicroController },
                { UnitTypes.PROTOSS_COLOSSUS, colossusMicroController },
                { UnitTypes.PROTOSS_DARKTEMPLAR, darkTemplarMicroController },
                { UnitTypes.PROTOSS_DISRUPTOR, disruptorMicroController },
                { UnitTypes.PROTOSS_DISRUPTORPHASED, disruptorPhasedMicroController },
                { UnitTypes.PROTOSS_HIGHTEMPLAR, highTemplarMicroController },
                { UnitTypes.PROTOSS_MOTHERSHIP, mothershipMicroController },
                { UnitTypes.PROTOSS_ORACLE, oracleMicroController },
                { UnitTypes.PROTOSS_PHOENIX, phoenixMicroController },
                { UnitTypes.PROTOSS_SENTRY, sentryMicroController },
                { UnitTypes.PROTOSS_STALKER, stalkerMicroController },
                { UnitTypes.PROTOSS_TEMPEST, tempestMicroController },
                { UnitTypes.PROTOSS_VOIDRAY, voidrayMicroController },
                { UnitTypes.PROTOSS_CARRIER, carrierMicroController },
                { UnitTypes.PROTOSS_WARPPRISM, warpPrismpMicroController },
                { UnitTypes.PROTOSS_WARPPRISMPHASING, warpPrismpMicroController },
                { UnitTypes.PROTOSS_ZEALOT, zealotMicroController },
                { UnitTypes.PROTOSS_OBSERVER, observerMicroController },

                { UnitTypes.ZERG_ZERGLING, zerglingMicroController },

                { UnitTypes.TERRAN_MARINE, marineMicroController },
                { UnitTypes.TERRAN_MARAUDER, marineMicroController },
                { UnitTypes.TERRAN_REAPER, reaperMicroController },
                { UnitTypes.TERRAN_BANSHEE, bansheeMicroController }
            };

            MicroData = new MicroData {
                IndividualMicroControllers = individualMicroControllers, IndividualMicroController = individualMicroController
            };

            DefenseService   = new DefenseService(ActiveUnitData);
            TargetingService = new TargetingService(ActiveUnitData, MapDataService, BaseData, TargetingData);
            MicroController  = new MicroController(MicroData);

            MicroTaskData = new MicroTaskData {
                MicroTasks = new Dictionary <string, IMicroTask>()
            };

            var defenseSquadTask        = new DefenseSquadTask(ActiveUnitData, TargetingData, DefenseService, MicroController, new ArmySplitter(AttackData, TargetingData, ActiveUnitData, DefenseService, MicroController), new List <DesiredUnitsClaim>(), 0, false);
            var workerScoutTask         = new WorkerScoutTask(SharkyUnitData, TargetingData, MapDataService, false, 0.5f, workerDefenseMicroController, DebugService, BaseData, AreaService);
            var workerScoutGasStealTask = new WorkerScoutGasStealTask(SharkyUnitData, TargetingData, MacroData, MapDataService, false, 0.5f, DebugService, BaseData, AreaService, MapData, BuildingService, ActiveUnitData);
            var findHiddenBaseTask      = new FindHiddenBaseTask(BaseData, TargetingData, MapDataService, individualMicroController, 15, false, 0.5f);
            var proxyScoutTask          = new ProxyScoutTask(SharkyUnitData, TargetingData, BaseData, SharkyOptions, false, 0.5f, workerProxyScoutMicroController);
            var miningDefenseService    = new MiningDefenseService(BaseData, ActiveUnitData, workerDefenseMicroController, DebugService);
            var miningTask               = new MiningTask(SharkyUnitData, BaseData, ActiveUnitData, 1, miningDefenseService, MacroData, BuildOptions);
            var queenInjectTask          = new QueenInjectsTask(ActiveUnitData, 1.1f, UnitCountService);
            var attackTask               = new AttackTask(MicroController, TargetingData, ActiveUnitData, DefenseService, MacroData, AttackData, TargetingService, MicroTaskData, new ArmySplitter(AttackData, TargetingData, ActiveUnitData, DefenseService, MicroController), new EnemyCleanupService(MicroController), 2);
            var adeptWorkerHarassTask    = new AdeptWorkerHarassTask(BaseData, TargetingData, adeptMicroController, 2, false);
            var oracleWorkerHarassTask   = new OracleWorkerHarassTask(TargetingData, BaseData, ChatService, MapDataService, MapData, oracleHarassMicroController, 1, false);
            var lateGameOracleHarassTask = new LateGameOracleHarassTask(BaseData, TargetingData, MapDataService, oracleHarassMicroController, 1, false);
            var reaperWorkerHarassTask   = new ReaperWorkerHarassTask(BaseData, TargetingData, reaperHarassMicroController, 2, false);
            var hallucinationScoutTask   = new HallucinationScoutTask(TargetingData, BaseData, false, .5f);
            var wallOffTask              = new WallOffTask(SharkyUnitData, TargetingData, ActiveUnitData, MacroData, WallOffPlacement, false, .25f);
            var destroyWallOffTask       = new DestroyWallOffTask(ActiveUnitData, false, .25f);

            MicroTaskData.MicroTasks[defenseSquadTask.GetType().Name]        = defenseSquadTask;
            MicroTaskData.MicroTasks[workerScoutGasStealTask.GetType().Name] = workerScoutGasStealTask;
            MicroTaskData.MicroTasks[workerScoutTask.GetType().Name]         = workerScoutTask;
            MicroTaskData.MicroTasks[findHiddenBaseTask.GetType().Name]      = findHiddenBaseTask;
            MicroTaskData.MicroTasks[proxyScoutTask.GetType().Name]          = proxyScoutTask;
            MicroTaskData.MicroTasks[miningTask.GetType().Name]               = miningTask;
            MicroTaskData.MicroTasks[queenInjectTask.GetType().Name]          = queenInjectTask;
            MicroTaskData.MicroTasks[attackTask.GetType().Name]               = attackTask;
            MicroTaskData.MicroTasks[adeptWorkerHarassTask.GetType().Name]    = adeptWorkerHarassTask;
            MicroTaskData.MicroTasks[oracleWorkerHarassTask.GetType().Name]   = oracleWorkerHarassTask;
            MicroTaskData.MicroTasks[lateGameOracleHarassTask.GetType().Name] = lateGameOracleHarassTask;
            MicroTaskData.MicroTasks[reaperWorkerHarassTask.GetType().Name]   = reaperWorkerHarassTask;
            MicroTaskData.MicroTasks[hallucinationScoutTask.GetType().Name]   = hallucinationScoutTask;
            MicroTaskData.MicroTasks[wallOffTask.GetType().Name]              = wallOffTask;
            MicroTaskData.MicroTasks[destroyWallOffTask.GetType().Name]       = destroyWallOffTask;

            MicroManager = new MicroManager(ActiveUnitData, MicroTaskData);
            Managers.Add(MicroManager);

            AttackDataManager = new AttackDataManager(AttackData, ActiveUnitData, attackTask, TargetPriorityService, TargetingData, MacroData, BaseData, DebugService);
            Managers.Add(AttackDataManager);

            BuildProxyService     = new BuildProxyService(MacroData, BuildingBuilder, SharkyUnitData, ActiveUnitData, Morpher, MicroTaskData);
            BuildingCancelService = new BuildingCancelService(ActiveUnitData, MacroData);
            MacroManager          = new MacroManager(MacroSetup, ActiveUnitData, SharkyUnitData, BuildingBuilder, SharkyOptions, BaseData, TargetingData, AttackData, WarpInPlacement, MacroData, Morpher, BuildOptions, BuildPylonService, BuildDefenseService, BuildProxyService, UnitCountService, BuildingCancelService);
            Managers.Add(MacroManager);

            EnemyStrategyHistory      = new EnemyStrategyHistory();
            EnemyData.EnemyStrategies = new Dictionary <string, IEnemyStrategy>
            {
                ["Proxy"]            = new EnemyStrategies.Proxy(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, TargetingData, DebugService, UnitCountService),
                ["WorkerRush"]       = new WorkerRush(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, TargetingData, DebugService, UnitCountService),
                ["InvisibleAttacks"] = new InvisibleAttacks(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService),

                ["AdeptRush"]         = new AdeptRush(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService),
                ["CannonRush"]        = new CannonRush(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, TargetingData, DebugService, UnitCountService),
                ["ProtossFastExpand"] = new ProtossFastExpand(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService, TargetingData),
                ["ProxyRobo"]         = new ProxyRobo(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService, TargetingData),
                ["ProxyStargate"]     = new ProxyStargate(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService, TargetingData),
                ["ZealotRush"]        = new ZealotRush(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService),

                ["MarineRush"]  = new MarineRush(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService),
                ["BunkerRush"]  = new BunkerRush(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, TargetingData, DebugService, UnitCountService),
                ["MassVikings"] = new MassVikings(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService),
                ["ThreeRax"]    = new ThreeRax(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService),

                ["ZerglingRush"] = new ZerglingRush(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService),
                ["RoachRavager"] = new RoachRavager(EnemyStrategyHistory, ChatService, ActiveUnitData, SharkyOptions, DebugService, UnitCountService)
            };

            EnemyStrategyManager = new EnemyStrategyManager(EnemyData);
            Managers.Add(EnemyStrategyManager);

            EmptyCounterTransitioner = new EmptyCounterTransitioner(EnemyData, SharkyOptions);

            var antiMassMarine   = new AntiMassMarine(BuildOptions, MacroData, ActiveUnitData, AttackData, ChatService, ChronoData, EmptyCounterTransitioner, UnitCountService, MicroTaskData);
            var fourGate         = new FourGate(BuildOptions, MacroData, ActiveUnitData, AttackData, ChatService, ChronoData, SharkyUnitData, EmptyCounterTransitioner, UnitCountService, MicroTaskData);
            var nexusFirst       = new NexusFirst(BuildOptions, MacroData, ActiveUnitData, AttackData, ChatService, ChronoData, EmptyCounterTransitioner, UnitCountService, MicroTaskData);
            var robo             = new Robo(BuildOptions, MacroData, ActiveUnitData, AttackData, ChatService, ChronoData, EnemyData, MicroTaskData, EmptyCounterTransitioner, UnitCountService);
            var protossRobo      = new ProtossRobo(BuildOptions, MacroData, ActiveUnitData, AttackData, ChatService, ChronoData, SharkyOptions, MicroTaskData, EnemyData, EmptyCounterTransitioner, UnitCountService);
            var everyProtossUnit = new EveryProtossUnit(BuildOptions, MacroData, ActiveUnitData, AttackData, ChatService, ChronoData, EmptyCounterTransitioner, UnitCountService, MicroTaskData);

            var protossBuilds = new Dictionary <string, ISharkyBuild>
            {
                [everyProtossUnit.Name()] = everyProtossUnit,
                [nexusFirst.Name()]       = nexusFirst,
                [robo.Name()]             = robo,
                [protossRobo.Name()]      = protossRobo,
                [fourGate.Name()]         = fourGate,
                [antiMassMarine.Name()]   = antiMassMarine
            };
            var protossSequences = new List <List <string> >
            {
                new List <string> {
                    everyProtossUnit.Name()
                },
                new List <string> {
                    nexusFirst.Name(), robo.Name(), protossRobo.Name()
                },
                new List <string> {
                    antiMassMarine.Name()
                },
                new List <string> {
                    fourGate.Name()
                }
            };
            var protossBuildSequences = new Dictionary <string, List <List <string> > >
            {
                [Race.Terran.ToString()]  = protossSequences,
                [Race.Zerg.ToString()]    = protossSequences,
                [Race.Protoss.ToString()] = protossSequences,
                [Race.Random.ToString()]  = protossSequences,
                ["Transition"]            = protossSequences
            };

            var massMarine      = new MassMarines(this);
            var battleCruisers  = new BattleCruisers(BuildOptions, MacroData, ActiveUnitData, AttackData, MicroTaskData, ChatService, UnitCountService);
            var everyTerranUnit = new EveryTerranUnit(BuildOptions, MacroData, ActiveUnitData, AttackData, ChatService, MicroTaskData, UnitCountService);
            var terranBuilds    = new Dictionary <string, ISharkyBuild>
            {
                [massMarine.Name()]      = massMarine,
                [battleCruisers.Name()]  = battleCruisers,
                [everyTerranUnit.Name()] = everyTerranUnit
            };
            var terranSequences = new List <List <string> >
            {
                new List <string> {
                    massMarine.Name(), battleCruisers.Name()
                },
                new List <string> {
                    everyTerranUnit.Name()
                },
                new List <string> {
                    battleCruisers.Name()
                },
            };
            var terranBuildSequences = new Dictionary <string, List <List <string> > >
            {
                [Race.Terran.ToString()]  = terranSequences,
                [Race.Zerg.ToString()]    = terranSequences,
                [Race.Protoss.ToString()] = terranSequences,
                [Race.Random.ToString()]  = terranSequences,
                ["Transition"]            = terranSequences
            };

            var basicZerglingRush = new BasicZerglingRush(BuildOptions, MacroData, ActiveUnitData, AttackData, ChatService, MicroTaskData, UnitCountService);
            var everyZergUnit     = new EveryZergUnit(BuildOptions, MacroData, ActiveUnitData, AttackData, MicroTaskData, ChatService, UnitCountService);
            var zergBuilds        = new Dictionary <string, ISharkyBuild>
            {
                [everyZergUnit.Name()]     = everyZergUnit,
                [basicZerglingRush.Name()] = basicZerglingRush
            };
            var zergSequences = new List <List <string> >
            {
                new List <string> {
                    everyZergUnit.Name()
                },
                new List <string> {
                    basicZerglingRush.Name(), everyZergUnit.Name()
                }
            };
            var zergBuildSequences = new Dictionary <string, List <List <string> > >
            {
                [Race.Terran.ToString()]  = zergSequences,
                [Race.Zerg.ToString()]    = zergSequences,
                [Race.Protoss.ToString()] = zergSequences,
                [Race.Random.ToString()]  = zergSequences,
                ["Transition"]            = zergSequences
            };

            MacroBalancer = new MacroBalancer(BuildOptions, ActiveUnitData, MacroData, SharkyUnitData, BaseData, UnitCountService);
            BuildChoices  = new Dictionary <Race, BuildChoices>
            {
                { Race.Protoss, new BuildChoices {
                      Builds = protossBuilds, BuildSequences = protossBuildSequences
                  } },
                { Race.Terran, new BuildChoices {
                      Builds = terranBuilds, BuildSequences = terranBuildSequences
                  } },
                { Race.Zerg, new BuildChoices {
                      Builds = zergBuilds, BuildSequences = zergBuildSequences
                  } }
            };
            BuildDecisionService = new BuildDecisionService(ChatService);
            BuildManager         = new BuildManager(BuildChoices, DebugService, MacroBalancer, BuildDecisionService, EnemyPlayerService, ChatHistory, EnemyStrategyHistory);
            Managers.Add(BuildManager);
        }
        private Balder.Objects.Geometries.Geometry CreateStoryGeometry(BuildingStory buildingStory)
        {
            StructuralArea layer = new BuildingBuilder().CreateSlab(
             new BuildingBasicDomain.Line(
             new BuildingBasicDomain.Point(0, buildingStory.EndingStoryHeightLevel, 0),
             new BuildingBasicDomain.Point(0, buildingStory.EndingStoryHeightLevel, 1)),
             1, -BuildingBuilder.xDirection);

            return CreateSlabGeometry(layer);
        }
Пример #15
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F1))
        {
            //var uimodetextgo = GameObject.FindGameObjectsWithTag("UI").FirstOrDefault(f => f.gameObject.name == "UI_ModeText");
            //UIBuildMode ubmscript = uimodetextgo.GetComponent<UIBuildMode>();
            //ubmscript.ToggleBuildMode();
            gm.SetBuildMode(!gm.buildMode);
        }
        if (Input.GetKeyDown(KeyCode.F2))
        {
            if (gm.selectedBuildingIndex > 0)
            {
                CursorObjectSwap cos = GameObject.FindGameObjectWithTag("Cursor").GetComponent <CursorObjectSwap>();
                cos.SetAllFalse();
                gm.selectedBuildingIndex--;
                //var uimodetextgo = GameObject.FindGameObjectsWithTag("UI").FirstOrDefault(f => f.gameObject.name == "UI_ModeText");
                //UIBuildMode ubmscript = uimodetextgo.GetComponent<UIBuildMode>();
                //ubmscript.SetBuildModeText();
            }
        }
        if (Input.GetKeyDown(KeyCode.F3))
        {
            if (gm.selectedBuildingIndex + 1 < gm.buildingArray.Length)
            {
                CursorObjectSwap cos = GameObject.FindGameObjectWithTag("Cursor").GetComponent <CursorObjectSwap>();
                cos.SetAllFalse();
                gm.selectedBuildingIndex++;
                //var uimodetextgo = GameObject.FindGameObjectsWithTag("UI").FirstOrDefault(f => f.gameObject.name == "UI_ModeText");
                //UIBuildMode ubmscript = uimodetextgo.GetComponent<UIBuildMode>();
                //ubmscript.SetBuildModeText();
            }
        }
        // Building mode
        if (Input.GetMouseButtonDown(0) && gm.buildMode && gm.canBuild)
        {
            BuildingBuilder builder = GameObject.FindGameObjectWithTag("Builder").GetComponent <BuildingBuilder>();
            builder.BuildBuilding(GameObject.FindGameObjectWithTag("Cursor").transform.position);
        }
        // Selection mode
        else if (Input.GetMouseButtonDown(0) && !gm.buildMode)
        {
            var        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit = new RaycastHit();

            if (Physics.Raycast(ray, out hit))
            {
                // If building is hit
                if (hit.collider.gameObject.tag == "Building_hitboxable")
                {
                    GameObject prevGo = null;
                    // If connecting, check if previous building exists basically
                    if (gm.connectButtonToggled && gm.selectedBuilding != null)
                    {
                        prevGo = gm.selectedBuilding;
                    }

                    BuildingScript bs = hit.collider.gameObject.GetComponent <BuildingScript>();
                    bs.Select(hit.collider.gameObject);
                    // Set selected building particle system
                    gm.SetParticleActive(true);

                    // Try connecting two buildings
                    if (prevGo != null && gm.selectedBuilding != null && prevGo != gm.selectedBuilding)
                    {
                        Debug.Log("Selection happened between " + prevGo.name + " :: " + gm.selectedBuilding.name);

                        var cs  = prevGo.GetComponent <BuildingConnections>();
                        var cs2 = gm.selectedBuilding.GetComponent <BuildingConnections>();

                        // Check if connection can be made between two buildings
                        if (cs.ConnectionCanBeAdded(cs2.connectionType) && cs2.ConnectionCanBeAdded(cs.connectionType))
                        {
                            cs.connections.Add(gm.selectedBuilding);

                            cs2.connections.Add(prevGo);

                            var cable  = Instantiate(gm.powerCablePrefab, prevGo.transform.position, gm.powerCablePrefab.transform.rotation);
                            var cableS = cable.GetComponent <PowerCablePath>();
                            cableS.SetPowerCable(prevGo.transform.position, gm.selectedBuilding.transform.position);

                            cs.createdCables.Add(cable);
                            cs2.createdCables.Add(cable);

                            gm.connectButtonToggled = false;
                        }
                        else
                        {
                            Debug.Log("Cannot create connection");
                        }
                    }
                }
            }
        }
    }
Пример #16
0
 public Building Construct(BuildingBuilder buildingBuilder)
 {
     return(buildingBuilder);
 }
Пример #17
0
 private void InitCastle()
 {
     BuildingBuilder.GetInstance().Build(BuildingBuilder.BuildingType.castle, allLands[0]);
 }