Esempio n. 1
0
        private void Awake()
        {
            ISDEBUGSCENE = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.ToLower().Contains("debug");
            if (ISDEBUGSCENE && !_initialized)
            {
                InitializeDebugWorld();
                return;
            }
            world          = this;
            FollowCamera   = this.followCamera;
            WORLD_DATAPATH = Application.persistentDataPath + "/Worlds/";
            if (!Directory.Exists(WORLD_DATAPATH))
            {
                Directory.CreateDirectory(WORLD_DATAPATH);
            }
            worldType     = WorldType.CLASSM;
            worldName     = "AlphaWorld";
            tribes        = new Dictionary <HexCell, Tribe>();
            civilizations = new List <Civilization>();
            civilizations.Add(new Civilization(BASE_SPECIES.Gnat, "DaGnats", true, 5, 15));
            HexMetrics.Initialize(worldType);
            hexGrid     = HexGrid.generate(this);
            mapCam.grid = hexGrid;
            //masterTerrain = GetComponent<RAKTerrainMaster>();
            if (editing)
            {
                editor = Instantiate(RAKUtilities.getWorldPrefab("HexMapEditor")).GetComponent <HexMapEditor>();
            }

            for (int count = 0; count < NUMBEROFSTARTINGCIVS; count++)
            {
                Tribe   tribe = new Tribe(1200, BASE_SPECIES.Gnat);
                HexCell cell  = tribe.FindHome(this, true);
                //civilizations[0].AddTribe(tribe);
                addTribe(tribe, cell);
            }
            hexGrid.RefreshAllChunks();
            mainMenu = new MenuController(creatureBrowserPrefab, worldBrowserPrefab, debugMenuPrefab);
            if (AutoLoadArea)
            {
                HexCell autoLoadCell = hexGrid.GetCell(new Vector3(0, 0, 0));
                LoadArea(autoLoadCell);
                mainMenu.Initialize(RootMenu.CreatureBrowser);
            }
            else
            {
                mainMenu.Initialize(RootMenu.WorldBrowser);
            }
            _initialized = true;
        }
Esempio n. 2
0
        private void InitializeDebugWorld()
        {
            civilizations = new List <Civilization>();
            civilizations.Add(new Civilization(BASE_SPECIES.Gnat, "DaGnats", true, 5, 15));
            Tribe debugTribe = new Tribe(5, BASE_SPECIES.Gnat);

            //civilizations[0].AddTribe(debugTribe);
            Debug.LogWarning("DEBUG MODE ENABLED");
            world     = this;
            worldType = WorldType.CLASSM;
            worldName = "DebugWorld";
            tribes    = new Dictionary <HexCell, Tribe>();
            HexMetrics.Initialize(worldType);
            hexGrid     = HexGrid.generate(this);
            currentCell = debugTribe.FindHome(this, true);
            masterTerrain.Initialize(this, currentCell);
            CurrentArea = currentCell.MakeArea(this, debugTribe);
            MenuController menuController = new MenuController(creatureBrowserPrefab, worldBrowserPrefab, debugMenuPrefab);

            FollowCamera = followCamera;
            menuController.Initialize(RootMenu.CreatureBrowser);
            _initialized = true;
        }