Created
November 25, 2013 21:27
-
-
Save jakevsrobots/7649201 to your computer and use it in GitHub Desktop.
A very simple dialog/conversation system using Unity's GUI functions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class Conversation : MonoBehaviour { | |
public GUISkin skin; | |
string scene = "start"; | |
void OnGUI() | |
{ | |
GUI.skin = skin; | |
GUILayout.BeginArea(new Rect(50,50, 250,250)); | |
if(scene == "start") | |
{ | |
GUILayout.BeginVertical(); | |
GUILayout.Label("Howdy."); | |
if(GUILayout.Button("O hai.")) | |
{ | |
scene = "hello"; | |
} | |
if(GUILayout.Button("Where the party is?")) | |
{ | |
scene = "party"; | |
} | |
GUILayout.EndVertical(); | |
} | |
else if(scene == "hello") | |
{ | |
GUILayout.BeginVertical(); | |
GUILayout.Label("Cool talk to you later."); | |
GUILayout.EndVertical(); | |
} | |
else if(scene == "party") | |
{ | |
GUILayout.BeginVertical(); | |
GUILayout.Label("I would also like to know."); | |
GUILayout.EndVertical(); | |
} | |
GUILayout.EndArea(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment