public void SaveLevel() { saveLevelButtons.interactable = false; List <GameObject> gameElements = new List <GameObject>(); for (int i = 0; i < mainElementsEditor.childCount; ++i) { gameElements.Add(mainElementsEditor.GetChild(i).gameObject); } Level lvl = LevelBuilder.BuildLevel(PuzzleEditorController.instance.levelSize, gameElements, PuzzleEditorController.instance.baseTM, PuzzleEditorController.instance.collidable); if (levelLoaded.name == levelName.text) { lvl.id = levelLoaded.id; } lvl.name = levelName.text; lvl.description = levelDescription.text; lvl.creatorName = username; levelLoaded = lvl; LevelBuilder.SaveLevel(lvl); }
public IEnumerator BuildTowers() { levelBuilder.ColorPaletteNames = GameObject.Find("LevelBuilder").GetComponent <LevelBuilder>().ColorPaletteNames; while (active) { foreach (var tower in GameObject.FindGameObjectsWithTag("tower")) { tower.tag = "old"; } foreach (var tower in GameObject.FindGameObjectsWithTag("PowerConduit")) { tower.tag = "old"; tower.GetComponent <PowerConduitScript>().UnlinkTowers(); } yield return(webCam.CalculateTexture()); levelBuilder.LegoBlocks = webCam.calculatedTexture; yield return(levelBuilder.BuildLevel()); foreach (var tower in GameObject.FindGameObjectsWithTag("old")) { Destroy(tower); } foreach (var tower in GameObject.FindGameObjectsWithTag("PowerConduit")) { tower.GetComponent <PowerConduitScript>().LinkTowers(); } yield return(new WaitForSeconds(waitingPeriod)); } }
IEnumerator ResetSceneAsync() { if (SceneManager.sceneCount > 1) { AsyncOperation asyncUnload = SceneManager.UnloadSceneAsync("LevelScene"); while (!asyncUnload.isDone) { yield return(null); Debug.Log("Unloading scene..."); } Debug.Log("Unload Done!"); Resources.UnloadUnusedAssets(); } AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("LevelScene", LoadSceneMode.Additive); while (!asyncLoad.isDone) { yield return(null); Debug.Log("Loading scene..."); } SceneManager.SetActiveScene(SceneManager.GetSceneByName("LevelScene")); Debug.Log("Build level"); levelBuilder.BuildLevel(); _player = FindObjectOfType <Player>(); _player.moves.Clear(); Debug.Log("Scene Loaded" + levelBuilder.GetComponent <LevelManager>()._levels.Count.ToString() + "Number of levels"); }
void LoadLevel() { LevelConfig levelConfig = chapterConfig.levels[CurrentLevel]; List <Enemy> newEnemyList = levelBuilder.BuildLevel(levelConfig); enemiesCount = newEnemyList.Count; // Init Controllers enemyMoveManager.Init(levelConfig.enemyConfig, newEnemyList); enemyShootManager.Init(levelConfig, newEnemyList); uiGameManager.Init(levelConfig.playerConfig.lives); // Callbacks levelBuilder.Player.onPlayerHit += OnPlayerHit; levelBuilder.Player.onPlayerHit += uiGameManager.OnPlayerHit; enemyMoveManager.onEnemyReachedLimit += Lose; foreach (Enemy enemy in newEnemyList) { enemy.onEnemyKilled += OnEnemyKilled; } StartCoroutine(StartLevelCoroutine()); }
public void Setup() { GameObject levelBuilderGO = MonoBehaviour.Instantiate(Resources.Load("LevelBuilderTest") as GameObject); levelBuilder = levelBuilderGO.GetComponent <LevelBuilder>(); enemies = levelBuilder.BuildLevel(ScriptableObject.CreateInstance <LevelConfig>()); levelBuilder.Player.SetData(ScriptableObject.CreateInstance <PlayerConfig>()); }
//https://www.youtube.com/watch?v=fja14SIwRQQ public override void OnInspectorGUI() { base.OnInspectorGUI(); if (GUILayout.Button("REgenerate The MAP!!!!!!!")) { LevelBuilder buildMap = (LevelBuilder)target; buildMap.BuildLevel(); } }
/// <summary> /// Starts building the level. /// </summary> /// <returns>The building level.</returns> public IEnumerator StartBuildingLevel() { yield return(CalculateTexture()); levelBuilder.LegoBlocks = calculatedTexture; yield return(levelBuilder.BuildLevel()); towerBuilder.active = true; towerBuilder.StartCoroutine(towerBuilder.BuildTowers()); }
public void PlayMe() { CurrentTier = TiersPerLevel; TowerAngle = 0f; //levelBuilder.BuildRandomLevel(); MainScreen.gameObject.SetActive(false); levelBuilder.BuildLevel(23); GameRunning = true; }
private void CreateLevel() { this.levelTime = 0; Level level = new Level(250); level.GenerateHeights(); level.GenerateFeatures(); level.GenerateMobs(); builder.BuildLevel(level.heights, level.features, level.mobs, level.goalPos, false); }
public override void OnInspectorGUI() { DrawDefaultInspector(); LevelBuilder levelBuilder = (LevelBuilder)target; if (GUILayout.Button("Build Level")) { levelBuilder.BuildLevel(); } }
public void SendLevelForBuild() { if (levels.Count > startLevelNumber - 1) { builder.BuildLevel(startLevelNumber, levels[startLevelNumber - 1]); if (startLevelNumber >= levels.Count) { startLevelNumber = cycleFrom; } else { startLevelNumber++; } } }
public void GoToBuilding() { cameraTimer.Stop(); capture.Stop(); if (board != null) { LevelCreator.BuildLevel(board); ScanningUI.SetActive(false); LevelViewerUI.SetActive(true); } else { EmptyBoardWarning.SetActive(true); } }
public override void OnInspectorGUI() { LevelBuilder myTarget = (LevelBuilder)target; DrawDefaultInspector(); if (GUILayout.Button("Build Level")) { myTarget.BuildLevel(); } if (GUILayout.Button("Clear Level")) { myTarget.ClearLevel(); } }
public override void OnInspectorGUI() { LevelBuilder level = (LevelBuilder)target; DrawDefaultInspector(); if (GUILayout.Button("Build Level")) { level.CleanLevel(); level.BuildLevel(); } if (GUILayout.Button("Clean Level")) { level.CleanLevel(); } }
private void Start() { LevelBuilder builderEditor = FindObjectOfType <LevelBuilder>(); if (builderEditor) { builderEditor.BuildLevel(FindObjectOfType <DataManager>().GetSelectedLevel(), FindObjectOfType <DataManager>().GetSelectedImageSet()); } for (int i = 1; i < 5; i++) { CreatePlayer(i, FindObjectOfType <DataManager>().GetIsPlayer(i), FindObjectOfType <DataManager>().GetPlayerControls(i)); } maxScore = FindObjectOfType <DataManager>().GetPointsToWin(); DisplayScore(0, 1); DisplayScore(0, 2); DisplayScore(0, 3); DisplayScore(0, 4); SpawnPickUp(); }
void FixedUpdate() { transform.localScale = new Vector3(transform.localScale.x, height, transform.localScale.z); if (up) { if (height < max) { height += heightSpeed; } else { up = false; } } else { if (height > min) { height -= heightSpeed; } else { up = true; } } if (active) { if (transform.position.y < -30 || transform.position.y > 60) { active = false; down = false; hurt.Play(); } if (Input.GetKey("d")) { rb.AddForce(speed * Time.deltaTime, 0, 0); } if (Input.GetKey("a")) { rb.AddForce(-speed * Time.deltaTime, 0, 0); } if (Input.GetKey("space")) { if (jumps > 0 && jumpable) { rb.AddForce(0, jumpForce * Time.deltaTime, 0); jumpable = false; jumps--; jumpSound.Play(); } } else { jumpable = true; } } else { if (size < 20 && !down) { size += sizeSpeed; } else if (size > 0) { down = true; size -= sizeSpeed; if (finished) { currentLevel++; finished = false; } if (started) { started = false; nextLevel.Play(); } level.BuildLevel(currentLevel); } else { active = true; size = 0; } quad.localScale = new Vector3(size, size, 0); } }
public void BuildAndLoad(string level) { info = LevelReader.LoadLevel(level); tiles = levelBuilder.BuildLevel(info.tiles); }