private void randomEncounter() { //This function facilitates random encounters. I'd rather do overworld encounters, but for the sake of time we in this shit Debug.Log("Being random encounter function"); if (encounterLimiter != 40) { encounterLimiter++; //This is the best tool to control encounter rate for some reason return; } int encounterGen = Random.Range(0, 100); Debug.Log(encounterGen); int encounterRate = 20; // set high for testing sake if (encounterGen < encounterRate) { Player playerScript = this.GetComponent <Player> (); GameManager.instance.SaveState(); string sceneName = "battlescene"; inBattle = true; int whichEnemy = Random.Range(1, 1); InfoTransition.setEnemyName(demoEnemyList[whichEnemy]); //This will be changed to randomly draw from a document with encounter data Scene scene = SceneManager.GetActiveScene(); InfoTransition.setSceneName(scene.name); InfoTransition.setPosition(playerScript.transform.position.x, playerScript.transform.position.y); UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName); } encounterLimiter = 0; }
public override void OnInteract() { Player playerScript = player.GetComponent <Player>(); if (playerScript.canMove && numMessages == 4) { playerScript.canMove = false; Debug.Log("demo"); txt.text = "This demo is mostly a showing of the tiles we have so far"; canvas.SetActive(true); numMessages--; } else if (numMessages == 3) { txt.text = "It's divided into two distinct areas for the tiles we have"; numMessages--; } else if (numMessages == 2) { txt.text = "As far as systems are concerned, basically everything except the battle system is completed"; numMessages--; } else if (numMessages == 1) { txt.text = "This isn't a lot, but having this base completed will let us build much faster over the next quarter. Enjoy!"; numMessages--; } else if (!playerScript.canMove && numMessages == 0) { canvas.SetActive(false); playerScript.canMove = true; numMessages = 4; Debug.Log("Battle activated"); GameManager.instance.SaveState(); string sceneName = "battlescene"; InfoTransition.setEnemyName("elonmuskrat"); Scene scene = SceneManager.GetActiveScene(); InfoTransition.setSceneName(scene.name); InfoTransition.setPosition(playerScript.transform.position.x, playerScript.transform.position.y); UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName); } //if(Input.GetButtonDown("Cancel")) //playerScript.canMove = true; }