Advertisement
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 //Code in the CampController script for the field trip
- {
- // Start is called before the first frame update
- void Start()
- {
- this.campingmusic.SetActive(false);
- this.campingmuswin.SetActive(false);
- this.campcharacter.SetActive(false);
- this.bushonkarrival.SetActive(false);
- this.schoolbus.SetActive(false);
- this.campwinitembox.SetActive(true);
- this.whoosh.SetActive(false);
- this.campcomplete = false;
- this.itemboxdissapear = false;
- this.playerwin = false;
- this.surviveforseconds.SetActive(false);
- this.gettothebus.SetActive(false);
- this.rewarditemtext.SetActive(false);
- }
- // Update is called once per frame
- void Update()
- {
- if (this.plsc.camping == true)
- {
- this.bal.SetActive(false);
- this.play.SetActive(false);
- this.pri.SetActive(false);
- this.sweep.SetActive(false);
- this.firstpri.SetActive(false);
- this.zeroth.SetActive(false);
- this.artsandcrafts.SetActive(false);
- this.bullychar.SetActive(false);
- this.notebooktext.SetActive(false);
- this.itembg.SetActive(false);
- this.itemslots.SetActive(false);
- this.select.SetActive(false);
- this.slot0.SetActive(false);
- this.slot1.SetActive(false);
- this.slot2.SetActive(false);
- this.itemstext.SetActive(false);
- StartCoroutine(StartCamp());
- }
- if (this.plsc.camping == false && this.campcomplete == true && this.playerwin == false)
- {
- this.bal.SetActive(true);
- 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);
- 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();
- }
- if (this.campcomplete == true)
- {
- this.surviveforseconds.SetActive(false);
- this.gettothebus.SetActive(true);
- this.bushonkarrival.SetActive(true);
- this.campcharacter.SetActive(false);
- }
- if (this.itemboxdissapear == true)
- {
- this.gettothebus.SetActive(false);
- this.campwinitembox.SetActive(false);
- this.whoosh.SetActive(true);
- }
- if (this.playerwin == true)
- {
- this.campingmusic.SetActive(false);
- this.gettothebus.SetActive(false);
- StartCoroutine(PlayerWin());
- }
- }
- IEnumerator StartCamp()
- {
- this.surviveforseconds.SetActive(true);
- this.campingmusic.SetActive(true);
- this.campcharacter.SetActive(true);
- float timer = 45f;
- while (timer > 0)
- {
- timer -= Time.deltaTime;
- yield return new WaitForEndOfFrame();
- }
- this.campcomplete = true;
- this.schoolbus.SetActive(true);
- }
- IEnumerator PlayerWin()
- {
- this.rewarditemtext.SetActive(true);
- this.campingmuswin.SetActive(true);
- this.plsc.walkSpeed = 0f;
- this.plsc.runSpeed = 0f;
- float timer = 5f;
- while (timer > 0)
- {
- timer -= Time.deltaTime;
- yield return new WaitForEndOfFrame();
- }
- this.plsc.walkSpeed = 10f;
- this.plsc.runSpeed = 16f;
- this.playerwin = false;
- this.rewarditemtext.SetActive(false);
- }
- public void CampRewards()
- {
- this.campwinitembox.SetActive(true);
- this.campbus.SetActive(false);
- this.itemboxdissapear = true;
- }
- public PlayerScript plsc;
- public GameObject bal;
- public GameObject play;
- public GameObject pri;
- public GameObject sweep;
- public GameObject zeroth;
- public GameObject firstpri;
- public GameObject artsandcrafts;
- public GameObject campcharacter;
- public GameObject bullychar;
- public GameObject campingmusic;
- public GameObject campingmuswin;
- public GameObject schoolbus;
- public bool campcomplete;
- public GameObject campbus;
- public GameObject campwinitembox;
- public GameObject whoosh;
- public bool itemboxdissapear;
- public bool playerwin;
- public GameObject notebooktext;
- public GameObject itembg;
- public GameObject select;
- public GameObject slot0;
- public GameObject slot1;
- public GameObject slot2;
- public GameObject itemslots;
- public GameObject itemstext;
- public GameObject rewarditemtext;
- public GameObject surviveforseconds;
- public GameObject gettothebus;
- public GameObject bushonkarrival;
- }
- //PlayerScript.cs
- // Token: 0x060000E1 RID: 225 RVA: 0x00007AC6 File Offset: 0x00005EC6
- {
- private void Start()
- {
- this.camping = false; //Set camping for the player to false
- }
- // Token: 0x060000E7 RID: 231 RVA: 0x00007FC8 File Offset: 0x000063C8
- private void OnTriggerEnter(Collider other)
- {
- else if (other.transform.name == "minigamebus") //If the player touches the 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 for the player to true
- }
- else if (other.transform.name == "schoolbus") //If the player touches the bus that takes them back to the school
- {
- this.player.position = new Vector3(-120f, 4f, 145f); // Teleport the player back to the schoolhouse
- this.camping = false; //Set player camping to false
- this.campscript.playerwin = true; //Set playerwin in the campcontroller script to true
- }
- else if (other.transform.name == "CampingChar") //If the player collides with the camping character
- {
- this.gameOver = true; //Give them a gameover
- }
- else if (other.transform.name == "Joeaudio") //If the player collides with the invisible box near the bus
- {
- this.joesaudio.SetActive(true); //Play joe's welcome audio
- }
- }
- public GameObject joesaudio;
- public CampController campscript; //Define the campcontroller script
- }
- //Campcharscript.cs
- public class CampCharScript : MonoBehaviour //Script for the charcter that chases you in the field trip
- {
- // Token: 0x060000AE RID: 174 RVA: 0x0000653A File Offset: 0x0000493A
- public void Start()
- {
- this.agent = base.GetComponent<UnityEngine.AI.NavMeshAgent>(); // Define the AI Agent
- }
- // Token: 0x060000AF RID: 175 RVA: 0x0000654E File Offset: 0x0000494E
- private void Update()
- {
- if (this.coolDown > 0f)
- {
- this.coolDown -= 1f * Time.deltaTime;
- }
- }
- // Token: 0x060000B0 RID: 176 RVA: 0x00006578 File Offset: 0x00004978
- private void FixedUpdate()
- {
- Vector3 direction = this.player.position - base.transform.position;
- RaycastHit raycastHit;
- if (Physics.Raycast(base.transform.position, direction, out raycastHit, float.PositiveInfinity, 3,
- QueryTriggerInteraction.Ignore) & raycastHit.transform.tag == "Player") //Check if its the player
- {
- this.dbs = true; //If the character sees the player
- this.TargetPlayer(); //Head towards the player
- }
- else
- {
- this.TargetPlayer(); //Target the player
- }
- }
- // Token: 0x060000B2 RID: 178 RVA: 0x00006658 File Offset: 0x00004A58
- private void TargetPlayer()
- {
- this.agent.SetDestination(this.player.position); //Set it's destination to the player
- this.coolDown = 1f;
- this.agent.speed = 9.5f; //Set the agent's speed to slightly less than player's walk speed (player walk speed = 10f)
- }
- // Token: 0x04000125 RID: 293
- public bool dbs; //Variable that determines if the character sees the player
- // Token: 0x04000126 RID: 294
- public Transform player; //Define the player
- // Token: 0x04000129 RID: 297
- public float coolDown;
- // Token: 0x0400012A RID: 298
- private UnityEngine.AI.NavMeshAgent agent;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement