Commit b6af08cb authored by Mitchie Maluschnig's avatar Mitchie Maluschnig
Browse files

created tutorial for pie throwing

parent 7d489e5b
This diff is collapsed.
fileFormatVersion: 2
guid: ac95c4f762ccacc42bc9b9b01cddba37
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -76,7 +76,10 @@ public class SimonSpeech : MonoBehaviour, Character {
conversation.Clear();
responseQueue.Clear();
if (GameManager.ConversationStage == 1) {
if (GameManager.SimonTutorial) {
loadTutorialConversation();
}else if (GameManager.ConversationStage == 1) {
conversationStage1();
} else if (GameManager.ConversationStage == 2) {
......@@ -135,4 +138,24 @@ public class SimonSpeech : MonoBehaviour, Character {
public string[] getResponses() {
return currentResponses;
}
private void loadTutorialConversation() {
conversation.Enqueue("*startled grr* (Hang on)");
responseQueue.Enqueue(new string[] { "okay" });
conversation.Enqueue("*confused grr* (Who are you? Where is our pie thrower?)");
responseQueue.Enqueue(new string[] { "okay" });
conversation.Enqueue("GRr (well its too late now, looks like youll have to be our pie thrower tonight)");
responseQueue.Enqueue(new string[] { "okay" });
conversation.Enqueue("GRR (Just hold down on SPACEBAR to select an angle)");
responseQueue.Enqueue(new string[] { "okay" });
conversation.Enqueue("grr (Great! Now release SPACEBAR to select your Power and fire the pie)");
responseQueue.Enqueue(new string[] { "okay" });
conversation.Enqueue("grR (Well Done! See if you can hit the rest)");
responseQueue.Enqueue(new string[] { "okay" });
}
}
......@@ -11,6 +11,15 @@ public class GameManager : MonoBehaviour {
public static string playerName = "goddamn";
public static bool FirstTimePie = true;
public static bool FirstTimeMime = false;
public static bool FirstTimeTrapeze = false;
public static bool SimonTutorial;
public static bool JohnTutorial;
public static bool SilasTutorial;
public static int TutorialState;
public static int ConversationStage;
public static int speechState;
......
......@@ -7,15 +7,25 @@ public class PerformanceMenu : MonoBehaviour {
// Use this for initialization
void Start () {
if (GameManager.FirstTimePie) {
SceneManager.LoadScene("PieThrowingTutorial");
}
}
public void PieThrowing() {
SceneManager.LoadScene("PieThrowing");
if (GameManager.FirstTimePie) {
SceneManager.LoadScene("PieThrowingTutorial");
} else {
SceneManager.LoadScene("PieThrowing");
}
}
public void MimeMime() {
SceneManager.LoadScene("MimeMime");
if (GameManager.FirstTimeMime) {
SceneManager.LoadScene("MimeMimeTutorial");
} else {
SceneManager.LoadScene("MimeMime");
}
}
public void SimonSays() {
......@@ -23,7 +33,11 @@ public class PerformanceMenu : MonoBehaviour {
}
public void Trapeze() {
SceneManager.LoadScene("Trapeze");
if (GameManager.FirstTimeTrapeze) {
SceneManager.LoadScene("TrapezeTutorial");
} else {
SceneManager.LoadScene("Trapeze");
}
}
public void ExitPerformance() {
......
......@@ -17,6 +17,7 @@ public class PieManager : MonoBehaviour {
private float exitTime;
public Text scoreText;
public bool tutorial;
private void Update()
{
......@@ -38,6 +39,11 @@ public class PieManager : MonoBehaviour {
float levels = score / 3000f;
GameManager.SimonLevel += levels;
SceneManager.LoadScene("Daytime");
if (tutorial) {
GameManager.SimonTutorial = false;
GameManager.TutorialState = 0;
GameManager.FirstTimePie = false;
}
} else {
exitTimer.text = ((int)(exitTime - Time.time + 0.98f)).ToString();
}
......@@ -50,60 +56,64 @@ public class PieManager : MonoBehaviour {
void Start()
{
exitText.gameObject.SetActive(false);
exitTime = Mathf.Infinity;
numTargets = Random.Range(1, 9);
PieTarget[] targets = FindObjectsOfType<PieTarget>();
for (int i = 0; i < 12 - numTargets; i++)
{
int n;
do
{
n = Random.Range(0, 9);
} while (targets[n].gameObject.activeSelf == false);
targets[n].gameObject.transform.parent.gameObject.SetActive(false);
}
numTargets = 0;
if (GameObject.FindGameObjectWithTag("TopMoving") != null)
{
if (GameObject.FindGameObjectWithTag("TopRight") != null)
{
GameObject.FindGameObjectWithTag("TopRight").SetActive(false);
if (tutorial) {
startTutorial();
} else {
exitText.gameObject.SetActive(false);
exitTime = Mathf.Infinity;
numTargets = Random.Range(1, 9);
PieTarget[] targets = FindObjectsOfType<PieTarget>();
for (int i = 0; i < 12 - numTargets; i++) {
int n;
do {
n = Random.Range(0, 9);
} while (targets[n].gameObject.activeSelf == false);
targets[n].gameObject.transform.parent.gameObject.SetActive(false);
}
if (GameObject.FindGameObjectWithTag("TopCentre") != null)
{
GameObject.FindGameObjectWithTag("TopCentre").SetActive(false);
}
}
if (GameObject.FindGameObjectWithTag("MiddleMoving") != null)
{
if (GameObject.FindGameObjectWithTag("MiddleRight") != null)
{
GameObject.FindGameObjectWithTag("MiddleRight").SetActive(false);
}
if (GameObject.FindGameObjectWithTag("MiddleCentre") != null)
{
GameObject.FindGameObjectWithTag("MiddleCentre").SetActive(false);
numTargets = 0;
if (GameObject.FindGameObjectWithTag("TopMoving") != null) {
if (GameObject.FindGameObjectWithTag("TopRight") != null) {
GameObject.FindGameObjectWithTag("TopRight").SetActive(false);
}
if (GameObject.FindGameObjectWithTag("TopCentre") != null) {
GameObject.FindGameObjectWithTag("TopCentre").SetActive(false);
}
}
}
if (GameObject.FindGameObjectWithTag("BottomMoving") != null)
{
if (GameObject.FindGameObjectWithTag("BottomRight") != null)
{
GameObject.FindGameObjectWithTag("BottomRight").SetActive(false);
if (GameObject.FindGameObjectWithTag("MiddleMoving") != null) {
if (GameObject.FindGameObjectWithTag("MiddleRight") != null) {
GameObject.FindGameObjectWithTag("MiddleRight").SetActive(false);
}
if (GameObject.FindGameObjectWithTag("MiddleCentre") != null) {
GameObject.FindGameObjectWithTag("MiddleCentre").SetActive(false);
}
}
if (GameObject.FindGameObjectWithTag("BottomCentre") != null)
{
GameObject.FindGameObjectWithTag("BottomCentre").SetActive(false);
if (GameObject.FindGameObjectWithTag("BottomMoving") != null) {
if (GameObject.FindGameObjectWithTag("BottomRight") != null) {
GameObject.FindGameObjectWithTag("BottomRight").SetActive(false);
}
if (GameObject.FindGameObjectWithTag("BottomCentre") != null) {
GameObject.FindGameObjectWithTag("BottomCentre").SetActive(false);
}
}
}
foreach (PieTarget target in targets)
{
if (target.gameObject.transform.parent.gameObject.activeSelf)
{
numTargets++;
foreach (PieTarget target in targets) {
if (target.gameObject.transform.parent.gameObject.activeSelf) {
numTargets++;
}
}
pieCount = numTargets * 2;
print("Num targets: " + numTargets + ", Num pies: " + pieCount);
//targets[0].gameObject.SetActive(false);
//gameObject.transform.GetComponent<MovingTarget>().gameObject.SetActive(true);
}
}
private void startTutorial() {
exitText.gameObject.SetActive(false);
exitTime = Mathf.Infinity;
PieTarget[] targets = FindObjectsOfType<PieTarget>();
numTargets = 3;
pieCount = numTargets * 2;
print("Num targets: " + numTargets + ", Num pies: " + pieCount);
//targets[0].gameObject.SetActive(false);
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class PieTutorial : MonoBehaviour {
public GameObject dialogueBox;
public Camera faceCam;
public Text SimonText;
public GameObject simon;
public SimonSpeech speech;
public Button button;
private int state;
private void Start() {
GameManager.SimonTutorial = true;
dialogueBox.SetActive(false);
speech = simon.GetComponent<SimonSpeech>();
speech.GreetingMessage();
SimonText.text = speech.converse();
StartCoroutine(noticePlayer());
}
private void Update() {
if(Input.GetKeyDown(KeyCode.Space) && GameManager.TutorialState == 1) {
progress();
}
if (Input.GetKeyUp(KeyCode.Space) && GameManager.TutorialState == 2){
progress();
}
}
private IEnumerator noticePlayer() {
yield return new WaitForSeconds(3);
dialogueBox.SetActive(true);
faceCam.gameObject.SetActive(true);
Time.timeScale = 0;
StopCoroutine(noticePlayer());
}
public void ButtonPress() {
progress();
}
void progress() {
state++;
if (state == 2) {
Time.timeScale = 1;
} else if (state == 3) {
//press space
button.gameObject.SetActive(false);
GameManager.TutorialState = 1;
} else if (state == 4) {
//relese space
GameManager.TutorialState = 2;
}else if(state == 5) {
GameManager.TutorialState = 3;
}
SimonText.text = speech.converse();
}
}
fileFormatVersion: 2
guid: 6e110f4bc90b75f49b08a347f29523aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -24,9 +24,36 @@ public class throwManager : MonoBehaviour {
// Update is called once per frame
void Update () {
if (GameManager.SimonTutorial) {
if (GameManager.TutorialState == 0) {
fillSomething(angleMeter);
} else if (GameManager.TutorialState == 1) {
if (Input.GetKeyDown(KeyCode.Space)) {
AngleState = PowerIncreasing;
PowerIncreasing = true;
}
if (Input.GetKeyUp(KeyCode.Space)) {
PowerIncreasing = AngleState;
}
if (Input.GetKey(KeyCode.Space)) {
fillSomething(powerBar);
} else {
fillSomething(angleMeter);
}
}else if(GameManager.TutorialState >= 2) {
manageThrow();
}
} else {
manageThrow();
}
}
void manageThrow() {
if (Input.GetKeyUp("space") && PieManager.pieCount > 0) {
//create pie object and set its power to the powerBars fill
GameObject pie = Instantiate(piePrefab, pieSpawn.position, Quaternion.Euler(new Vector3(0, 0, (1 - angleMeter.fillAmount) * -90 )));
GameObject pie = Instantiate(piePrefab, pieSpawn.position, Quaternion.Euler(new Vector3(0, 0, (1 - angleMeter.fillAmount) * -90)));
pie.GetComponent<Pie>().force = powerBar.fillAmount;
PieManager.pieInScene = true;
PieManager.pieCount--;
......@@ -42,12 +69,12 @@ public class throwManager : MonoBehaviour {
if (Input.GetKey(KeyCode.Space)) {
fillSomething(powerBar);
} else {
fillSomething(angleMeter);
resetMeter(powerBar);
}
}
}
}
void fillSomething(Image thing) {
if (Time.time > timeCount) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment