Advertisement
Guest User

Text Game Code

a guest
Jul 7th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. public class TextController : MonoBehaviour {
  6.  
  7. public Text text;
  8.  
  9. private enum States {Earth, ship, Kepler, Epic, TauCete, Mars}
  10. private States myState;
  11.  
  12. // Use this for initialization
  13. void Start () {
  14. myState = States.Earth;
  15. text.text = "The human race is no more, with the exception of a few scientists.";
  16. }
  17.  
  18. // Update is called once per frame
  19. void Update () {
  20. print (myState);
  21. if (myState == States.Earth) {state_Earth();}
  22. else if (myState == States.ship) {state_ship();}
  23. else if (myState == States.Kepler) {state_Kepler();}
  24. else if (myState == States.Epic) {state_Epic();}
  25. else if (myState == States.TauCete) {state_TauCete();}
  26. else if (myState == States.Mars) {state_Mars();}
  27. }
  28.  
  29.  
  30. void state_Earth() {
  31. text.text = "You have been provided with sufficently " +
  32. "diverse specimens of DNA, and all of the " +
  33. "data needed, to find a suitable planet " +
  34. "and clone the beginning of the new human " +
  35. "race to populate it.\n\n " +
  36. "Press S to board escape ship or T to go into " +
  37. "terminator mode on the remaining humans and " +
  38. "repopulate the world with androids " ;
  39. if (Input.GetKeyDown(KeyCode.S)) {
  40. myState = States.ship;
  41. }
  42. }
  43. void state_ship() {
  44. text.text = "For which planet do you wish to set course? \n " +
  45. "Press K for Kepler planets, E for Epic, T for " +
  46. "Tau Cete, or M for Mars " ;
  47. if (Input.GetKeyDown(KeyCode.K)) {
  48. myState = States.Kepler;
  49. }
  50.  
  51. if (Input.GetKeyDown(KeyCode.E)) {
  52. myState = States.Epic;
  53. }
  54. if (Input.GetKeyDown(KeyCode.T)) {
  55. myState = States.TauCete;
  56. }
  57. if (Input.GetKeyDown(KeyCode.M)) {
  58. myState = States.Mars;
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement