/Scripts/controlInstruction.js

http://acid-and-base.googlecode.com/ · JavaScript · 51 lines · 36 code · 6 blank · 9 comment · 5 complexity · 13d744695652c43ddb2d329e285cfbd3 MD5 · raw file

  1. var showGUI = true;
  2. var showScale = false;
  3. var canShowScale = false;
  4. var scale : Texture2D;
  5. function Update () {
  6. if (Input.GetKeyDown(KeyCode.Escape))
  7. {
  8. if(showGUI){
  9. showGUI = false;
  10. }
  11. else{
  12. showGUI = true;
  13. }
  14. if(showScale){
  15. showScale = false;
  16. }
  17. else{
  18. showScale = true;
  19. }
  20. }
  21. }
  22. function OnGUI()
  23. {
  24. if (showGUI)
  25. {
  26. GUI.Box(Rect(0,0,300,90), "W,A,S,D - Move\nQ - Switch Character\nE - Interact/Pickup & Drop Item\nLeft Mouse Button - Camera Control\nESC - Pause\n");
  27. }
  28. /*
  29. var pha = GameObject.Find("Acid").GetComponent("Properties").ph;
  30. var phb = GameObject.Find("Base").GetComponent("Properties").ph;
  31. GUI.Box(Rect(Screen.width - 100,0,100,40),"");
  32. GUI.Label(Rect(Screen.width - 100,0,100,20),"Acid = "+pha);
  33. GUI.Label(Rect(Screen.width - 100,20,100,20),"Base = "+phb);
  34. */
  35. if (showScale)
  36. {
  37. var pha = GameObject.Find("Acid").GetComponent("Properties").ph;
  38. var phb = GameObject.Find("Base").GetComponent("Properties").ph;
  39. GUI.Label(Rect(Screen.width - scale.width,0,scale.width, scale.height), scale);
  40. GUI.Label(Rect(Screen.width - scale.width + 32*pha - 13, 12, 10, 20),"A");
  41. GUI.Label(Rect(Screen.width - scale.width + 32*phb - 14, 32, 10, 20), "B");
  42. }
  43. //GUI.Label(Rect(Screen.width - 100,200,100,20),"Acid = "+pha);
  44. //GUI.Label(Rect(Screen.width - 100,220,100,20),"Base = "+phb);
  45. }