public void Start() { //init world _tileHandler.CreateMapInfo(_worldData.MapTiles); _tileHandler.CreateMap(_worldData.MapTiles, this.gameObject); _plantHandler.CreatePlant(_worldData.PlantGroup, _worldData.MapTiles); }
IEnumerator waitForSceneLoad(int sceneNumber) { while (SceneManager.GetActiveScene().buildIndex != sceneNumber) { yield return(null); } // Do anything after proper scene has been loaded if (SceneManager.GetActiveScene().buildIndex == sceneNumber) { if (SceneManager.GetActiveScene().buildIndex == 1) { //Debug.Log(SceneManager.GetActiveScene().buildIndex); //initialize player pc = GameObject.FindWithTag("Player").GetComponent <PlayerControlls>(); if (saveOnLoad) { mh.CreateNewMap(); pc.seed = new int[] { mh.tl, mh.tc, mh.tr, mh.ml, mh.mc, mh.mr, mh.bl, mh.bc, mh.br }; SaveSystem.SavePlayer(pc); cachedGold = pc.gold; } else { PlayerData data = SaveSystem.LoadPlayer(); if (startingLevel) { data.position = new float[3] { -10, -10, 0 } } ; pc.LoadFromSave(data); mh.SetSeed(pc.seed[0], pc.seed[1], pc.seed[2], pc.seed[3], pc.seed[4], pc.seed[5], pc.seed[6], pc.seed[7], pc.seed[8]); mh.CreateMap(); mh.SetAStarGrids(); foreach (GameObject item in queuedItems) { item.GetComponent <Item>().Pickup(pc); pc.gold = cachedGold; } queuedItems = new List <GameObject>(); } } if (SceneManager.GetActiveScene().buildIndex == 2) { sash.Stock(); } } } }
public void NewGame() { mapHandler.CreateMap(); }