Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- // Token: 0x0200000B RID: 11
- public class CTRL_CampingScript : MonoBehaviour
- {
- // Token: 0x06000034 RID: 52 RVA: 0x000032E5 File Offset: 0x000014E5
- private void Start()
- {
- Debug.Log("Camping Controller Start");
- base.StartCoroutine("Timer");
- this.UpdateStickCount();
- this.normalWalkSpeed = this.ps.walkSpeed;
- this.normalRunSpeed = this.ps.runSpeed;
- }
- // Token: 0x06000035 RID: 53 RVA: 0x00003328 File Offset: 0x00001528
- private void Update()
- {
- this.MouseTexture();
- if (Input.GetMouseButtonDown(0))
- {
- Debug.Log("Click");
- Ray ray = Camera.main.ScreenPointToRay(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2), 0f));
- RaycastHit raycastHit;
- if (Physics.Raycast(ray, out raycastHit))
- {
- if (raycastHit.transform.tag == "Firewood" & Vector3.Distance(this.player.position, raycastHit.transform.position) < 10f)
- {
- Debug.Log("My object is clicked by mouse");
- UnityEngine.Object.Destroy(raycastHit.transform.gameObject);
- this.AddSticks(1);
- }
- else if (raycastHit.transform.name == "Fire" & Vector3.Distance(this.player.position, raycastHit.transform.position) < 10f)
- {
- this.fire.BuildFire(this.sticks);
- this.AddSticks(this.sticks * -1);
- }
- }
- }
- if (Input.GetKeyDown(KeyCode.R))
- {
- this.AddSticks(this.sticks * -1);
- }
- }
- // Token: 0x06000036 RID: 54 RVA: 0x0000345C File Offset: 0x0000165C
- private IEnumerator Timer()
- {
- float t = 1f;
- while (t > 0f)
- {
- t -= Time.deltaTime;
- yield return new WaitForEndOfFrame();
- }
- this.time--;
- if (this.time < 0)
- {
- Time.timeScale = 0f;
- this.AddScore(Mathf.RoundToInt(this.fire.fireLevel * 10000f));
- this.winscreenbg.SetActive(true);
- this.finalText.gameObject.SetActive(true);
- this.finalText.text = string.Concat(new object[]
- {
- "Wow, you are good at camping!\nFire Bonus:\n",
- Mathf.RoundToInt(this.fire.fireLevel * 10000f),
- "\n\nYour Score:\n",
- this.score,
- "\n\nWith that score, you get these great things! Congrats!"
- });
- if (this.score >= 50000)
- {
- this.reward1.SetActive(true);
- this.reward2.SetActive(true);
- this.reward3.SetActive(true);
- this.reward4.SetActive(true);
- }
- else if (this.score >= 25000)
- {
- this.reward1.SetActive(true);
- this.reward2.SetActive(true);
- this.reward3.SetActive(true);
- }
- else
- {
- this.reward1.SetActive(true);
- }
- base.StartCoroutine("WinTime");
- this.audioDevice.PlayOneShot(this.winMusic);
- }
- else
- {
- this.timeText.text = "Time: " + this.time;
- base.StartCoroutine("Timer");
- }
- yield break;
- }
- // Token: 0x06000037 RID: 55 RVA: 0x00003478 File Offset: 0x00001678
- public void AddSticks(int amount)
- {
- this.sticks += amount;
- this.UpdateStickCount();
- if (this.sticks > 3)
- {
- this.ps.walkSpeed = this.normalWalkSpeed - (float)(8 * (this.sticks - 3)) / ((float)(this.sticks - 3) + 2f / this.speedScale);
- this.ps.slowSpeed = this.ps.walkSpeed;
- this.ps.runSpeed = this.normalRunSpeed - (float)(8 * (this.sticks - 3)) / ((float)(this.sticks - 3) + 2f / this.speedScale);
- }
- else
- {
- this.ps.walkSpeed = this.normalWalkSpeed;
- this.ps.slowSpeed = this.normalWalkSpeed;
- this.ps.runSpeed = this.normalRunSpeed;
- }
- }
- // Token: 0x06000038 RID: 56 RVA: 0x0000355B File Offset: 0x0000175B
- private void UpdateStickCount()
- {
- this.stickText.text = this.sticks + " Sticks";
- }
- // Token: 0x06000039 RID: 57 RVA: 0x0000357D File Offset: 0x0000177D
- public void AddScore(int points)
- {
- this.score += points;
- this.scoreText.text = this.score + " Points";
- }
- // Token: 0x0600003A RID: 58 RVA: 0x000035B0 File Offset: 0x000017B0
- public void BigScore(int value)
- {
- this.bigScoreText.text = "BIG POINTS! \n" + value;
- this.bigScoreText.gameObject.SetActive(true);
- this.audioDevice.PlayOneShot(this.bigScoreSound);
- base.StartCoroutine("BigScoreTime");
- }
- // Token: 0x0600003B RID: 59 RVA: 0x00003608 File Offset: 0x00001808
- private IEnumerator BigScoreTime()
- {
- float t = 1f;
- while (t > 0f)
- {
- t -= Time.deltaTime;
- yield return new WaitForEndOfFrame();
- }
- this.bigScoreText.gameObject.SetActive(false);
- yield break;
- }
- // Token: 0x0600003C RID: 60 RVA: 0x00003624 File Offset: 0x00001824
- private IEnumerator WinTime()
- {
- float t = 10f;
- while (t > 0f)
- {
- t -= Time.unscaledDeltaTime;
- yield return new WaitForEndOfFrame();
- }
- this.msct.UnlockCursor();
- this.msct.UnlockMouse();
- SceneManager.LoadScene("TestTitleScreen");
- yield break;
- }
- // Token: 0x0600003D RID: 61 RVA: 0x00003638 File Offset: 0x00001838
- public void SpawnBaldi()
- {
- this.baldi.SetActive(true);
- this.msct.UnlockCursor();
- this.msct.UnlockMouse();
- SceneManager.LoadScene("TestMinigameLost");
- }
- private void MouseTexture()
- {
- Ray ray = Camera.main.ScreenPointToRay(new Vector2(Screen.width / 2, Screen.height / 2));
- RaycastHit raycastHit;
- if (Physics.Raycast(ray, out raycastHit) && (raycastHit.collider.tag == "Firewood" & Vector3.Distance(this.player.position, raycastHit.transform.position) < 10f))
- {
- {
- this.reticle.SetActive(false);
- this.reticle2.SetActive(true);
- return;
- }
- }
- if (Physics.Raycast(ray, out raycastHit) && (raycastHit.collider.tag == "Fire" & Vector3.Distance(this.player.position, raycastHit.transform.position) < 10f))
- {
- {
- this.reticle.SetActive(false);
- this.reticle2.SetActive(true);
- return;
- }
- }
- {
- this.reticle.SetActive(true);
- this.reticle2.SetActive(false);
- return;
- }
- }
- // Token: 0x04000052 RID: 82
- public int sticks;
- // Token: 0x04000053 RID: 83
- public int score;
- // Token: 0x04000054 RID: 84
- public int time;
- // Token: 0x04000055 RID: 85
- public float speedScale;
- // Token: 0x04000056 RID: 86
- public GameObject baldi;
- // Token: 0x04000057 RID: 87
- public GameObject reward1;
- // Token: 0x04000058 RID: 88
- public GameObject reward2;
- // Token: 0x04000059 RID: 89
- public GameObject reward3;
- // Token: 0x0400005A RID: 90
- public GameObject reward4;
- public GameObject winscreenbg;
- // Token: 0x0400005B RID: 91
- public Text stickText;
- // Token: 0x0400005C RID: 92
- public Text scoreText;
- // Token: 0x0400005D RID: 93
- public Text bigScoreText;
- // Token: 0x0400005E RID: 94
- public Text timeText;
- // Token: 0x0400005F RID: 95
- public Text finalText;
- // Token: 0x04000060 RID: 96
- public Transform player;
- // Token: 0x04000061 RID: 97
- public PlayerScript ps;
- // Token: 0x04000062 RID: 98
- private float normalWalkSpeed;
- // Token: 0x04000063 RID: 99
- private float normalRunSpeed;
- // Token: 0x04000064 RID: 100
- public FireScript fire;
- // Token: 0x04000065 RID: 101
- public AudioSource audioDevice;
- // Token: 0x04000066 RID: 102
- public AudioClip bigScoreSound;
- // Token: 0x04000067 RID: 103
- public AudioClip winMusic;
- public MouseScriptCampingTest msct;
- public GameObject reticle;
- public GameObject reticle2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement