Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CampController : MonoBehaviour //Script for the camping field trip minigame
- {
- // Start is called before the first frame update
- void Start() //When you start playing the mod
- {
- this.campingmusic.SetActive(false); //Disable the camping music
- this.campingmuswin.SetActive(false); //Disable the mus_win music
- this.campcharacter.SetActive(false); //Disable the character that chases you
- this.schoolbus.SetActive(false); //Disable the bus that takes you back to the schoolhouse
- this.campwinitembox.SetActive(true); //Activate the box surrounding the reward
- this.whoosh.SetActive(false); //Disable the bal_wow sound
- this.campcomplete = false; //Set campcomplete to false
- this.itemboxdissapear = false; //Set itemboxdissapear to false
- this.playerwin = false; //Set playerwin to false
- }
- // Update is called once per frame
- void Update()
- {
- if (this.plsc.camping == true) //If the player has begun camping
- {
- this.bal.SetActive(false); //Disable Baldi
- this.play.SetActive(false); //Disable playtime
- this.pri.SetActive(false); //Disable pott
- this.sweep.SetActive(false); //Disable gotta sweep
- this.firstpri.SetActive(false); //Disable 1st prize
- this.zeroth.SetActive(false); //Disable 0th Prize
- this.artsandcrafts.SetActive(false); //Disable aac
- this.bullychar.SetActive(false); //Disable the bully
- this.notebooktext.SetActive(false); //Disable the notebook text (/7 Notebooks) in the hud
- this.itembg.SetActive(false); //Disable the item slots in the hud
- this.itemslots.SetActive(false); //Disable the item slots in the hud
- this.select.SetActive(false); //Disable the item slots in the hud
- this.slot0.SetActive(false); //Disable the item slots in the hud
- this.slot1.SetActive(false); //Disable the item slots in the hud
- this.slot2.SetActive(false); //Disable the item slots in the hud
- this.itemstext.SetActive(false); //Disable the item text in the hud
- StartCoroutine(StartCamp()); //Start the camping minigame
- }
- if (this.plsc.camping == false && this.campcomplete == true && this.playerwin == false) //If the player is not camping, has finished the camping minigame, and the win animation has finished
- {
- this.bal.SetActive(true); //Reactivate all the previously deactivated characters
- this.play.SetActive(true);
- this.pri.SetActive(true);
- this.sweep.SetActive(true);
- this.firstpri.SetActive(true);
- this.zeroth.SetActive(true);
- this.artsandcrafts.SetActive(true);
- this.bullychar.SetActive(true);
- this.notebooktext.SetActive(true);
- this.itembg.SetActive(true); //Reactivate the disabled HUD elements
- this.itemslots.SetActive(true);
- this.select.SetActive(true);
- this.slot0.SetActive(true);
- this.slot1.SetActive(true);
- this.slot2.SetActive(true);
- this.itemstext.SetActive(true);
- this.CampRewards(); //Start the camp rewards
- }
- if (this.campcomplete == true) //If the player has finished camping
- {
- this.campcharacter.SetActive(false); //Disable the character that chases you
- }
- if (this.itemboxdissapear == true) //If itemboxdissapear is set to true
- {
- this.campwinitembox.SetActive(false); //Disable the item box surrounding the reward
- this.whoosh.SetActive(true); //Activate the bal_wow sound
- }
- if (this.playerwin == true) //If the player has won the camping minigame
- {
- this.campingmusic.SetActive(false); //Disable the camping music
- StartCoroutine(PlayerWin()); //Start the player win animation
- }
- }
- IEnumerator StartCamp()
- {
- this.campingmusic.SetActive(true); //Activate the camping music
- this.campcharacter.SetActive(true); //Activate the camping character
- float timer = 45f; //Field trip lasts for 45 seconds
- while (timer > 0) //If the field trip time left is 0
- {
- timer -= Time.deltaTime;
- yield return new WaitForEndOfFrame();
- }
- this.campcomplete = true; //Set campcomplete to true
- this.schoolbus.SetActive(true); //Activate the bus that takes you back to the school
- }
- IEnumerator PlayerWin()
- {
- this.campingmuswin.SetActive(true); //Active the mus_win music
- this.plsc.walkSpeed = 0f; //Set player's walk speed to 0
- this.plsc.runSpeed = 0f; //Set player's run speed to 0
- float timer = 5f; //Keep the player frozen in place for 5 seconds
- while (timer > 0) //If the time left is 0
- {
- timer -= Time.deltaTime;
- yield return new WaitForEndOfFrame();
- }
- this.plsc.walkSpeed = 10f; //Set the player's walk speed back to normal
- this.plsc.runSpeed = 16f; //Set the player's run speed back to normal
- this.playerwin = false; //Set playerwin to false
- }
- public void CampRewards()
- {
- this.campwinitembox.SetActive(true); //Activate the item box surrounding the reward
- this.campbus.SetActive(false); //Deactive the field trip bus
- this.itemboxdissapear = true; //Set itemboxdissapear to true
- }
- public PlayerScript plsc; //Define the player script
- public GameObject bal; //Characters
- public GameObject play; //Characters
- public GameObject pri; //Characters
- public GameObject sweep; //Characters
- public GameObject zeroth; //Characters
- public GameObject firstpri; //Characters
- public GameObject artsandcrafts; //Characters
- public GameObject campcharacter; //Characters
- public GameObject bullychar; //Characters
- public GameObject campingmusic; //Camping music gameobject
- public GameObject campingmuswin; //Camping win music gameobject
- public GameObject schoolbus; //Field trip bus gameobject
- public bool campcomplete;
- public GameObject campbus; //Field trip bus gameobject 2
- public GameObject campwinitembox;
- public GameObject whoosh;
- public bool itemboxdissapear;
- public bool playerwin;
- public GameObject notebooktext; //Player HUD elements
- public GameObject itembg; //Player HUD elements
- public GameObject select; //Player HUD elements
- public GameObject slot0; //Player HUD elements
- public GameObject slot1; //Player HUD elements
- public GameObject slot2; //Player HUD elements
- public GameObject itemslots; //Player HUD elements
- public GameObject itemstext; //Player HUD elements
- }
- public class PlayerScript : MonoBehaviour //Code in the player script for the field trip
- {
- private void OnTriggerEnter(Collider other)
- {
- else if (other.transform.name == "minigamebus") //If the player touches the field trip bus in the school
- {
- this.player.position = new Vector3(-259f, 4f, 55f); // Teleport the player to the camping field trip minigame
- this.camping = true; //Set camping to true
- }
- else if (other.transform.name == "schoolbus") //If the player touches the bus that appears when the field trip is completed
- {
- this.player.position = new Vector3(-120f, 4f, 145f); // Teleport the player back to the schoolhouse
- this.camping = false; //Set camping to false
- this.campscript.playerwin = true; //Set playerwin to true
- }
- else if (other.transform.name == "CampingChar") //If the player touches the character in the field trip chasing them
- {
- this.gameOver = true; //Give the player a gameover
- }
- }
- public CampController campscript; //Define the campcontroller script
- }
Advertisement
Add Comment
Please, Sign In to add comment