- Home /
Making a Tutorial in th emiddle of screen and more efficiant
Hello,
im making a Tutorial for a game. My question now is how can i make the box apear in the middle of the screen. The other thing is i have a lot of bools right now but im afraid that if the tutorial should hold more information i will confuse myselfe with them.
I hope you can help me.
using UnityEngine;
using System.Collections;
public class Tutorial : MonoBehaviour {
private bool showTutorial = false;
private bool endTutorial = false;
private bool bewegungSteuerung = false;
private bool turretErklaerung = false;
private bool schildErklaerung = false;
public Texture BG;
public float vSbarValue;
bool showGUI = false;
void OnTriggerEnter()
{
if (!endTutorial)
{
showTutorial = true;
showGUI = true;
}
}
void Update()
{
if (!endTutorial && showTutorial)
{
Time.timeScale = 0; //Frezze time
}
if (endTutorial)
{
Time.timeScale = 1; //Frezze time
showGUI = false;
}
}
void OnGUI()
{
if (showGUI)
{
GUILayout.BeginArea(new Rect((Screen.width - 1000), (Screen.height - 500), (Screen.width / 100) * 75, (Screen.height / 100) * 60), BG); //Die box für den text
GUILayout.EndArea();
GUILayout.BeginArea(new Rect((Screen.width - 925), (Screen.height - 400), (Screen.width / 100) * 25, (Screen.height / 100) * 45)); //Die box für den text
if (showTutorial && !endTutorial)
{
GUILayout.Label("Wilkommen in unserem Mächting tutorial!");
GUILayout.Label("Wilkommen im Tutorail LVL hier erfährst du die wichtigsten Spielelemente.");
if (GUILayout.Button("Ja, erkläre mir das Wichtigste!"))
{
bewegungSteuerung = true;
showTutorial = false;
endTutorial = false;
}
if (GUILayout.Button("ICH BIN EIN PRO! SCHLUSS DAMIT"))
{
bewegungSteuerung = false;
schildErklaerung = false;
turretErklaerung = false;
endTutorial = true;
}
}
if (bewegungSteuerung == true)
{
GUILayout.Label("Bewegungs steuerung (BroBot und FemBot)");
GUILayout.Label("Du bewegst dich durch den LVL ");
if (GUILayout.Button("GIB MIR MEHR INFOS ÜBER DIE GEGNER"))
{
turretErklaerung = true;
bewegungSteuerung = false;
}
if (GUILayout.Button("AHHH LASS MICH RAUS ICH WILL ZOCKEN"))
{
bewegungSteuerung = false;
turretErklaerung = false;
endTutorial = true;
}
}
if (turretErklaerung == true)
{
GUILayout.Label("Einführung in die Gegner (BroBot und FemBot)");
GUILayout.Label("In diesem Spiel gibt es Zwei verschiedene arten von Gegnern.");
if (GUILayout.Button("JA ERZÄHL MIR MEHR ÜBER DAS SCHILD"))
{
schildErklaerung = true;
turretErklaerung = false;
}
if (GUILayout.Button("ICH WILL JETZT ENDLICH ZOCKEN"))
{
bewegungSteuerung = false;
schildErklaerung = false;
turretErklaerung = false;
endTutorial = true;
}
}
if (schildErklaerung == true)
{
GUILayout.Label("Einführung in das Schild (BroBot only)");
GUILayout.Label("Um den Schild zu aktivieren drücke.");
if (GUILayout.Button("ICH HABE ALLES GELESEN, VORTSETZEN"))
{
schildErklaerung = false;
turretErklaerung = false;
endTutorial = true;
}
}
GUILayout.EndArea();
}
}
}
Well. As you can see from
if (GUILayout.Button("ICH WILL JETZT ENDLICH ZOC$$anonymous$$EN"))
Then he is using GUI Boxes
Answer by Dann858 · Jan 31, 2013 at 04:23 PM
I don't exactly see the problem in the bools. Their names are pretty understandable. (I can speak a little bit German)
I've used a script of some sort like this. It's bigger and I call them
public bool DisplayText1;
public bool DisplayContinueButton1;
public bool DisplayText2;
public bool DisplayContinueButton2;
etc.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
GUI functions switching 2 Answers
Multiple Cars not working 1 Answer
Drawing 4 GUIButton's with a forloop. Need help changing color? 1 Answer
GUI objects jitter when following "lerped" Gameobject [SOLVED] 1 Answer