Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- var MenuSkin : GUISkin;
- //References
- var player : GameObject;
- var mainCamera : GameObject;
- var arms : GameObject;
- //Icons
- var campfireIcon : Texture;
- var BigTentIcon : Texture;
- var teepeeIcon : Texture;
- var tentIcon : Texture;
- var emptyIcon2 : Texture;
- var emptyIcon3 : Texture;
- var emptyIcon4 : Texture;
- var emptyIcon5 : Texture;
- var emptyIcon6 : Texture;
- //Player prefabs
- var campFire : GameObject;
- var BigTent : GameObject;
- var teepee : GameObject;
- var tent : GameObject;
- var empty2 : GameObject;
- var empty3 : GameObject;
- var empty4 : GameObject;
- var empty5 : GameObject;
- var empty6 : GameObject;
- // scripts
- private var showGUI : boolean = false;
- private var invScript : Inventory;
- function Start()
- {
- invScript = GetComponent(Inventory);
- }
- function Update()
- {
- if(Input.GetKeyDown("c"))
- {
- showGUI = !showGUI;
- }
- if(showGUI == true)
- {
- Time.timeScale = 0;
- player.GetComponent(FPSInputController).enabled = false;
- player.GetComponent(MouseLook).enabled = false;
- mainCamera.GetComponent(MouseLook).enabled = false;
- arms.GetComponent(PlayerControl).enabled = false;
- }
- if(showGUI == false)
- {
- Time.timeScale = 1;
- player.GetComponent(FPSInputController).enabled = true;
- player.GetComponent(MouseLook).enabled = true;
- mainCamera.GetComponent(MouseLook).enabled = true;
- arms.GetComponent(PlayerControl).enabled = true;
- }
- }
- function OnGUI()
- {
- if(showGUI == true)
- {
- GUI.skin = MenuSkin;
- GUI.BeginGroup(new Rect(Screen.width/2-150,Screen.height/2-150,300,300));
- GUI.Box(Rect(0 , 0, 260, 300),"Crafting System");
- if(GUI.Button(Rect(10, 50, 50, 50), GUIContent (campfireIcon, "Build a campfire")))
- {
- if(invScript.wood >= 6 && invScript.stone >= 3)
- {
- campFire.SetActive(true);
- BigTent.SetActive(false);
- tent.SetActive(false);
- teepee.SetActive(false);
- invScript.wood -= 6;
- invScript.stone -= 3;
- }
- }
- if(GUI.Button(Rect(10, 120, 50, 50), GUIContent (BigTentIcon, "Build a Bigger Tent?")))
- {
- if(invScript.wood >= 10 && invScript.stone >= 5 && invScript.clay >= 3)
- {
- BigTent.SetActive(true);
- campFire.SetActive(false);
- teepee.SetActive(false);
- tent.SetActive(false);
- invScript.wood -= 10;
- invScript.stone -= 5;
- }
- }
- if(GUI.Button(Rect(10, 190, 50, 50), GUIContent(teepeeIcon, "Build a TeePee!")))
- {
- if(invScript.wood >= 10 && invScript.stone >= 5)
- {
- teepee.SetActive(true);
- BigTent.SetActive(false);
- tent.SetActive(false);
- campFire.SetActive(false);
- invScript.wood -= 10;
- invScript.stone -= 5;
- }
- }
- // SECOND COLLUMN
- if(GUI.Button(Rect(100, 50, 50, 50), GUIContent(tentIcon, "Build a tent!")))
- {
- if(invScript.wood >= 10 && invScript.stone >= 5)
- {
- tent.SetActive(true);
- teepee.SetActive(false);
- BigTent.SetActive(false);
- campFire.SetActive(false);
- invScript.wood -= 10;
- invScript.stone -= 5;
- }
- }
- if(GUI.Button(Rect(100, 120, 50, 50), GUIContent(emptyIcon2, "This is just a place holder")))
- {
- if(invScript.wood >= 10 && invScript.stone >= 5)
- {
- empty2.SetActive(true);
- teepee.SetActive(false);
- BigTent.SetActive(false);
- campFire.SetActive(false);
- invScript.wood -= 10;
- invScript.stone -= 5;
- }
- }
- if(GUI.Button(Rect(100, 190, 50, 50), GUIContent(emptyIcon3, "This is just a place holder")))
- {
- if(invScript.wood >= 10 && invScript.stone >= 5)
- {
- empty3.SetActive(true);
- teepee.SetActive(false);
- BigTent.SetActive(false);
- campFire.SetActive(false);
- invScript.wood -= 10;
- invScript.stone -= 5;
- }
- }
- if(GUI.Button(Rect(190, 50, 50, 50), GUIContent(emptyIcon4, "This is just a place holder")))
- {
- if(invScript.wood >= 10 && invScript.stone >= 5)
- {
- empty4.SetActive(true);
- teepee.SetActive(false);
- BigTent.SetActive(false);
- campFire.SetActive(false);
- invScript.wood -= 10;
- invScript.stone -= 5;
- }
- }
- if(GUI.Button(Rect(190, 120, 50, 50), GUIContent(emptyIcon5, "This is just a place holder")))
- {
- if(invScript.wood >= 10 && invScript.stone >= 5)
- {
- empty5.SetActive(true);
- teepee.SetActive(false);
- BigTent.SetActive(false);
- campFire.SetActive(false);
- invScript.wood -= 10;
- invScript.stone -= 5;
- }
- }
- if(GUI.Button(Rect(190, 190, 50, 50), GUIContent(emptyIcon6, "This is just a place holder")))
- {
- if(invScript.wood >= 10 && invScript.stone >= 5)
- {
- empty6.SetActive(true);
- teepee.SetActive(false);
- BigTent.SetActive(false);
- campFire.SetActive(false);
- invScript.wood -= 10;
- invScript.stone -= 5;
- }
- }
- GUI.Label (Rect (100, 250, 100, 40), GUI.tooltip);
- GUI.EndGroup ();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement