Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class FountainQuestion : FountainAnswer
- {
- //provides a countdown until question and checks to see if there already is a question.
- void Update()
- {
- if (RandTimer >= 0 && randPanel.activeInHierarchy == false)
- {
- //stops esteem, risk, and satisfaction from updating by tuning off player collider.
- gameObject.GetComponent<BoxCollider2D>().enabled = true;
- //resume the game
- timeFactor = 1;
- //deactivate the buttons
- fountainYes.SetActive(false);
- fountainNo.SetActive(false);
- }
- else
- {
- //stops esteem, risk, and satisfaction from updating by tuning off player collider.
- gameObject.GetComponent<BoxCollider2D>().enabled = false;
- //pause the game
- timeFactor = 0;
- //activate the question
- randPanel.SetActive(true);
- }
- }
- //when RandTimer is zero this code acts as a switch to activate the question by checking to see if the player is in a matching location
- void OnTriggerStay2D(Collider2D other)
- {
- RandTimer -= Time.deltaTime;
- if (RandTimer <= 0)
- {
- activateFountainQuestion = true;
- fountainYes.SetActive(true);
- fountainNo.SetActive(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement