Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

using System; using System.Collections; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI;

// Token: 0x0200001F RID: 31 public class GameControllerScript : MonoBehaviour { // Token: 0x06000080 RID: 128 RVA: 0x0000438C File Offset: 0x0000278C public GameControllerScript() { int[] array = new int[5]; array[0] = -320; array[1] = -240; array[2] = -160; array[3] = -80; this.itemSelectOffset = array; }

// Token: 0x06000081 RID: 129 RVA: 0x00004448 File Offset: 0x00002848 private void Start() { this.audioDevice = base.GetComponent<AudioSource>(); //Get the Audio Source this.mode = PlayerPrefs.GetString("CurrentMode"); //Get the current mode if (this.mode == "endless") //If it is endless mode { this.baldiScrpt.endless = true; //Set Baldi use his slightly changed endless anger system } this.schoolMusic.Play(); //Play the school music this.LockMouse(); //Prevent the mouse from moving this.UpdateNotebookCount(); //Update the notebook count this.itemSelected = 0; //Set selection to item slot 0(the first item slot) this.gameOverDelay = 0.5f; }

// Token: 0x06000082 RID: 130 RVA: 0x000044BC File Offset: 0x000028BC private void Update() { this.MouseAppearing();

if (!this.learningActive) { if (Input.GetButtonDown("Pause")) { if (!this.gamePaused) { this.PauseGame(); } else { this.UnpauseGame(); } } if (Input.GetKeyDown(KeyCode.Y) & this.gamePaused) { SceneManager.LoadScene("MainMenu"); } else if (Input.GetKeyDown(KeyCode.N) & this.gamePaused) { this.UnpauseGame(); } if (!this.gamePaused & Time.timeScale != 1f) { Time.timeScale = 1f; } if (Input.GetMouseButtonDown(1)) { this.UseItem(); } if (Input.GetAxis("Mouse ScrollWheel") > 0f) { this.DecreaseItemSelection(); } else if (Input.GetAxis("Mouse ScrollWheel") < 0f) { this.IncreaseItemSelection(); } if (Input.GetKeyDown(KeyCode.Alpha1)) { this.itemSelected = 0; this.UpdateItemSelection(); } else if (Input.GetKeyDown(KeyCode.Alpha2)) { this.itemSelected = 1; this.UpdateItemSelection(); } else if (Input.GetKeyDown(KeyCode.Alpha3)) { this.itemSelected = 2; this.UpdateItemSelection(); } else if (Input.GetKeyDown(KeyCode.Alpha4)) { this.itemSelected = 3; this.UpdateItemSelection(); } else if (Input.GetKeyDown(KeyCode.Alpha5)) { this.itemSelected = 4; this.UpdateItemSelection(); } } else if (Time.timeScale != 0f) { Time.timeScale = 0f; } if (this.player.stamina < 0f & !this.warning.activeSelf) { this.warning.SetActive(true); //Set the warning text to be visible } else if (this.player.stamina > 0f & this.warning.activeSelf) { this.warning.SetActive(false); //Set the warning text to be invisible } if (this.player.gameOver) { Time.timeScale = 0f; //Pause the game this.gameOverDelay -= Time.unscaledDeltaTime; this.audioDevice.PlayOneShot(this.aud_buzz); //Play the jumpscare sound if (this.gameOverDelay <= 0f) { if (this.mode == "endless") //If it is in endless { if (this.notebooks > PlayerPrefs.GetInt("HighBooks")) //If the player achieved a new score { PlayerPrefs.SetInt("HighBooks", this.notebooks); //Update the high score PlayerPrefs.SetInt("HighTime", Mathf.FloorToInt(this.time)); //(Unused) Update the time this.highScoreText.SetActive(true); // "WOW KAZOW! THATS A NEW HIGH SCORE!" } else if (this.notebooks == PlayerPrefs.GetInt("HighBooks") & Mathf.FloorToInt(this.time) > PlayerPrefs.GetInt("HighTime")) //(Unused) If the player has a brand new record for time { PlayerPrefs.SetInt("HighTime", Mathf.FloorToInt(this.time)); //Update the high time this.highScoreText.SetActive(true); // "WOW KAZOW! THATS A NEW HIGH SCORE!" } PlayerPrefs.SetInt("CurrentBooks", this.notebooks); //Update the high score PlayerPrefs.SetInt("CurrentTime", Mathf.FloorToInt(this.time)); //(Unused) Update the time } Time.timeScale = 1f; // Unpause the game SceneManager.LoadScene("GameOver"); // Go to the game over screen } } if (this.finaleMode && !this.audioDevice.isPlaying && this.exitsReached == 3) //Play the weird sound after getting some exits { this.audioDevice.clip = this.aud_MachineLoop; this.audioDevice.loop = true; this.audioDevice.Play(); } }

// Token: 0x06000083 RID: 131 RVA: 0x00004828 File Offset: 0x00002C28 private void UpdateNotebookCount() { if (this.mode == "Floor 1") { this.notebookCount.text = this.notebooks.ToString() + "/9 Notebooks"; } else { this.notebookCount.text = this.notebooks.ToString() + " Notebooks"; } if (this.notebooks == 9 & this.mode == "Floor 1") { this.ActivateFinaleMode(); } }

// Token: 0x06000084 RID: 132 RVA: 0x000048C0 File Offset: 0x00002CC0 public void CollectNotebook() { this.notebooks++; this.UpdateNotebookCount(); this.time = 0f; }

// Token: 0x06000085 RID: 133 RVA: 0x000048E1 File Offset: 0x00002CE1 public void LockMouse() { if (!this.learningActive) { this.cursorController.LockCursor(); //Prevent the cursor from moving this.mouseLocked = true; this.reticle.SetActive(true); } }

// Token: 0x06000086 RID: 134 RVA: 0x0000490C File Offset: 0x00002D0C public void UnlockMouse() { this.cursorController.UnlockCursor(); //Allow the cursor to move this.mouseLocked = false; this.reticle.SetActive(false); }

// Token: 0x06000087 RID: 135 RVA: 0x0000492C File Offset: 0x00002D2C private void PauseGame() { Time.timeScale = 0f; this.gamePaused = true; this.pauseText.SetActive(true); this.baldiNod.SetActive(true); this.baldiShake.SetActive(true); }

// Token: 0x06000088 RID: 136 RVA: 0x00004963 File Offset: 0x00002D63 private void UnpauseGame() { Time.timeScale = 1f; this.gamePaused = false; this.pauseText.SetActive(false); this.baldiNod.SetActive(false); this.baldiShake.SetActive(false); }

// Token: 0x06000089 RID: 137 RVA: 0x0000499C File Offset: 0x00002D9C public void ActivateSpoopMode() { this.spoopMode = true; //Tells the game its time for spooky this.entrance_0.Lower(); //Lowers all the exits this.entrance_1.Lower(); this.entrance_2.Lower(); this.entrance_3.Lower(); this.baldiTutor.SetActive(false); //Turns off Baldi(The one that you see at the start of the game) this.quarter.SetActive(false); // Baldi takes the Quarter he gives you if you haven't picked it up yet this.baldi.SetActive(true); //Turns on Baldi this.principal.SetActive(true); //Turns on Principal this.principalson.SetActive(true); //Turns on Principal's Son this.crafters.SetActive(true); //Turns on Crafters this.playtime.SetActive(true); //Turns on Playtime this.beans.SetActive(true); // Turns on Beans this.clocker.SetActive(true); // Turns on Clocker from BFNS+ this.kingofdoors.SetActive(true); this.gottaSweep.SetActive(true); //Turns on Gotta Sweep this.bully.SetActive(true); //Turns on Bully this.firstPrize.SetActive(true); //Turns on First-Prize this.audioDevice.PlayOneShot(this.aud_Hang); //Plays the hang sound this.learnMusic.Stop(); //Stop all the music this.schoolMusic.Stop();

if (this.rcs.zerothSpawnChance >= 5f) { this.zeroprize.SetActive(true); } else { this.zeroprize.SetActive(false); } if (this.rcs.cloudySpawnChance >= 2f) { this.cloudycopter.SetActive(true); } else { this.cloudycopter.SetActive(false); } if (this.rcs.testditheredSpawnChance >= 15f) { this.testdithered.SetActive(true); } else { this.testdithered.SetActive(false); } }

// Token: 0x0600008A RID: 138 RVA: 0x00004A63 File Offset: 0x00002E63 private void ActivateFinaleMode() { this.finaleMode = true; this.entrance_0.Raise(); //Raise all the enterances(make them appear) this.entrance_1.Raise(); this.entrance_2.Raise(); this.entrance_3.Raise(); }

// Token: 0x0600008B RID: 139 RVA: 0x00004A98 File Offset: 0x00002E98 public void GetAngry(float value) //Make Baldi get angry { if (!this.spoopMode) { this.ActivateSpoopMode(); } this.baldiScrpt.GetAngry(value); }

// Token: 0x0600008C RID: 140 RVA: 0x00004AB7 File Offset: 0x00002EB7 public void ActivateLearningGame() { this.learningActive = true; this.UnlockMouse(); //Unlock the mouse this.tutorBaldi.Stop(); //Make tutor Baldi stop talking if (!this.spoopMode) //If the player hasn't gotten a question wrong { this.schoolMusic.Stop(); //Start playing the learn music this.learnMusic.Play(); } }

// Token: 0x0600008D RID: 141 RVA: 0x00004AF4 File Offset: 0x00002EF4 public void DeactivateLearningGame(GameObject subject) { this.learningActive = false; UnityEngine.Object.Destroy(subject); this.LockMouse(); //Prevent the mouse from moving if (this.player.stamina < player.maxStamina) //Reset Stamina { this.player.stamina = this.player.maxStamina * 1f; } if (!this.spoopMode) //If it isn't spoop mode, play the school music { this.schoolMusic.Play(); this.learnMusic.Stop(); } if (this.notebooks == 1 & !this.spoopMode) // If this is the players first notebook and they didn't get any questions wrong, reward them with a quarter { this.quarter.SetActive(true); this.tutorBaldi.PlayOneShot(this.aud_Prize); } else if (this.notebooks == 9 & this.mode == "Floor 1") // Plays the all 9 notebook sound { this.audioDevice.PlayOneShot(this.aud_AllNotebooks, 0.8f); } }

// Token: 0x0600008E RID: 142 RVA: 0x00004BCC File Offset: 0x00002FCC private void IncreaseItemSelection() { this.itemSelected++; if (this.itemSelected > 4) { this.itemSelected = 0; } this.itemSelect.anchoredPosition = new Vector3((float)this.itemSelectOffset[this.itemSelected], -10f, -10f); //Moves the item selector background(the red rectangle) this.UpdateItemName(); }

// Token: 0x0600008F RID: 143 RVA: 0x00004C30 File Offset: 0x00003030 private void DecreaseItemSelection() { this.itemSelected--; if (this.itemSelected < 0) { this.itemSelected = 4; } this.itemSelect.anchoredPosition = new Vector3((float)this.itemSelectOffset[this.itemSelected], -10f, -10f); //Moves the item selector background(the red rectangle) this.UpdateItemName(); }