Пример #1
0
	void OnGUI ()
	{
		if(!UseManager) return;

		float sw =Screen.width, sh= Screen.height;

		shared creatureScript=null;
		if(creaturesList.Count>0 && creaturesList[selected] && creaturesList[selected].activeInHierarchy)
			creatureScript=creaturesList[selected].GetComponent<shared>();  //Get creature script
		
		GUIStyle style = new GUIStyle("box"); style.fontSize=16;
		if(Cursor.lockState==CursorLockMode.None)
		{
			//Show creature info on toolbar & Camera mode select
			if(creatureScript&&CameraMode!=0)
			{
				GUI.Box(new Rect(0, 0, sw, 50), creaturesList[selected].name);
				GUI.color=Color.yellow; if(GUI.Button(new Rect(0,5, (sw/16)-4, 20), "Free")) CameraMode=0;
				if(CameraMode==1) GUI.color=Color.green; if(GUI.Button(new Rect((sw/16)*1.5f, 5, (sw/16)-4, 20), "Follow")) CameraMode=1; GUI.color=Color.yellow;
				if(CameraMode==2) GUI.color=Color.green; if(GUI.Button(new Rect((sw/16)*3.0f, 5, (sw/16)-4, 20), "POV")) CameraMode=2;
			}
			else
			{
				GUI.Box(new Rect(0, 0, sw, 50), "", style);
				if(creatureScript)
				{
					GUI.color=Color.green; GUI.Button(new Rect(0,5, (sw/16)-4, 20), "Free"); GUI.color=Color.yellow;
					if(GUI.Button(new Rect((sw/16)*1.5f, 5, (sw/16)-4, 20), "Follow")) CameraMode=1;
					if(GUI.Button(new Rect((sw/16)*3.0f, 5, (sw/16)-4, 20), "POV")) CameraMode=2; 
				}
			}
			GUI.color=Color.white;

			Cursor.visible = true;
			//Toolbar tabs
			if(!ShowGUI) GUI.Box(new Rect(0, 0, sw, 50), ""); 
			string[] toolbarStrings = new string[] {"File", "Creatures", "Options", "Help"};
			GUI.color=Color.yellow; toolBarTab = GUI.Toolbar(new Rect(0, 30, sw, 20), toolBarTab, toolbarStrings); GUI.color=Color.white;

			switch(toolBarTab)
			{
			//File
			case 0: GUI.Box (new Rect(0, 50, sw, sh-50), "", style);
				if(GUI.Button(new Rect((sw/2)-60, (sh/2)-35, 120, 30), "Reset")) SceneManager.LoadScene(0); //Reset				
				if(GUI.Button (new Rect((sw/2)-60, (sh/2)+5, 120, 30), "Quit")) Application.Quit(); //Quit
			break;
			//Creatures
			case 1:
			if(creatureScript)
			{
				// Creature box
				GUI.Box (new Rect(0, 50, sw*0.25f, (sh*0.75f)-50),"");

				// Creature name - rename field
				string rename=creaturesList[selected].name;
				creaturesList[selected].name=GUI.TextField(new Rect(25, 50, sw*0.25f-25, 25), rename, style);

				//Delete button
				if(GUI.Button (new Rect(0, 50, 25, 25), "X"))
				{
					Destroy(creaturesList[selected].gameObject);  creaturesList.RemoveAt(selected);
					if(selected>0) selected--; else if(creaturesList.Count>0) selected=creaturesList.Count-1; else return;
				}

				//Browse Creatures
				if(browser)
				{
					if(GUI.Button (new Rect(0, 75, (sw*0.25f), 25), "Close Browser" )) browser=false;
					GUI.Box (new Rect(0, 100, sw*0.25f, (sh*0.75f)-100),"Creatures : "+creaturesList.Count);
					scroll1 = GUI.BeginScrollView(new Rect(0, 130, sw*0.25f, (sh*0.75f)-140), scroll1, new Rect(0, 0, 270, creaturesList.Count*40), false, true);

					int end_i=creaturesList.Count, start=Mathf.RoundToInt(scroll1.y/40);
					end_i=Mathf.Clamp(end_i, start , start+Mathf.RoundToInt((sh*0.75f)/40));
		
					for(int i=start; i<end_i; i++)
					{
						float line =	40*i;
						//green light for current selected creature
						if(selected!=i) GUI.color=Color.gray; else GUI.color=Color.white;
						//draw creature array num
						GUI.Label (new Rect(5, line, sw*0.25f-30, 25), (i+1)+". " );
						// delete button
						if(GUI.Button (new Rect(30, line, 20, 20), "X" ))
						{
							if(i<=selected && selected>0 | selected==creaturesList.Count-1) selected--;
							Destroy(creaturesList[i].gameObject);  creaturesList.RemoveAt(i); return;
						}
						//button show creature name/select creature
						if(GUI.Button (new Rect(50, line, 140, 20), creaturesList[i].name )) { selected=i; CameraMode=1; }
						if(GUI.Button (new Rect(190, line, 40, 20), "Edit" )) { selected=i;  browser=false; }
						//get creature script
						shared Script= creaturesList[i].gameObject.GetComponent<shared>();
						//show current creature behavior
						GUI.Label (new Rect(235, line, sw*0.25f-30, 25), Script.behavior+"  "+Script.behaviorCount);
						//browser health bar
						Rect bar= new Rect(0, 0, 0.1f, 0.1f);
						GUI.color=Color.black; GUI.DrawTextureWithTexCoords(new Rect(30, line+22, 50, 4), icons, bar, false);
						GUI.DrawTextureWithTexCoords(new Rect(85, line+22, 50, 4), icons, bar, false);
						GUI.color=Color.green; GUI.DrawTextureWithTexCoords(new Rect(30, line+22, Script.Health/2, 4), icons, bar, false); 
						GUI.color=Color.yellow; GUI.DrawTextureWithTexCoords(new Rect(85,line+22, Script.Food/2, 4), icons, bar, false);
						if(!Script.CanSwim)
						{
							GUI.color=Color.black; GUI.DrawTextureWithTexCoords(new Rect(140, line+22, 50, 4), icons, bar, false);
							GUI.DrawTextureWithTexCoords(new Rect(195, line+22, 50, 4), icons, bar, false);
							GUI.color=Color.cyan; GUI.DrawTextureWithTexCoords(new Rect(140, line+22, Script.Water/2, 4), icons, bar, false); 
							GUI.color=Color.gray; GUI.DrawTextureWithTexCoords(new Rect(195,line+22, Script.Fatigue/2, 4), icons, bar, false); 
						}
					}
					GUI.EndScrollView();
				}
				else
				{
					//Start browse
					if(GUI.Button (new Rect((sw*0.25f)/4, 75, (sw*0.25f)/2, 20), "Browse : "+(selected+1)+"/"+creaturesList.Count )) browser=true;

					//Creature select
					if(GUI.Button (new Rect(0, 75,  (sw*0.25f)/4, 20), "<<")) 	{ if(selected>0) selected--; else selected=creaturesList.Count-1; } 
					if(GUI.Button (new Rect(((sw*0.25f)/4)*3, 75, (sw*0.25f)/4, 20), ">>")) { if(selected < creaturesList.Count-1) selected++; else selected=0; }

					scroll1 = GUI.BeginScrollView(new Rect(0, 110, sw*0.25f, (sh*0.75f)-110), scroll1, new Rect(0, 0, 0, 430), false, true);

					//AI on/off
					if(creatureScript.AI)
					{
						GUI.color=Color.gray; if(GUI.Button (new Rect(sw*0.25f/2, 0, sw*0.25f/2-20, 25), "Player")) creatureScript.SetAI(false);
						GUI.color=Color.green; GUI.Box (new Rect(10, 0, sw*0.25f/2-10, 25), "A.I. : "+creatureScript.behavior );
					}
					else
					{
						GUI.color=Color.green; GUI.Box (new Rect(sw*0.25f/2, 0, sw*0.25f/2-20, 25), "Player");
						GUI.color=Color.gray; if(GUI.Button (new Rect(10, 0, sw*0.25f/2-10, 25), "A.I." )) creatureScript.SetAI(true);
					}

					GUI.color=Color.white;

					//Model materials
					int body= creatureScript.BodySkin.GetHashCode();
					int eyes= creatureScript.EyesSkin.GetHashCode();
					if(GUI.Button (new Rect(10, 30, sw*0.25f-30, 25), "Body Skin : "+creatureScript.BodySkin))
					{ if(body<2) body++; else body=0; creatureScript.SetMaterials(body, eyes); }
				
					if(GUI.Button (new Rect(10, 60, sw*0.25f-30, 25), "Eyes Skin : "+creatureScript.EyesSkin))
					{ if(eyes<15)eyes++; else eyes=0; creatureScript.SetMaterials(body, eyes); }

					//Model scale
					float Scale=creaturesList[selected].transform.localScale.x;
						GUI.Box(new Rect(10, 90, sw*0.25f-30, 25), "Scale : "+Mathf.Round(Scale*100)/100);
					Scale=GUI.HorizontalSlider(new Rect(10, 110, sw*0.25f-30, 25), Scale, 0.1f, 1.0f);
					if(Scale!=creaturesList[selected].transform.localScale.x) creaturesList[selected].SendMessage("SetScale", Mathf.Round(Scale*100)/100);
					//Animation speed
					float Speed= creatureScript.AnimSpeed;
					GUI.Box(new Rect(10, 125, sw*0.25f-30, 25), "Animation Speed : "+Mathf.Round(Speed*100)/100);
					creatureScript.AnimSpeed=GUI.HorizontalSlider(new Rect(10, 145, sw*0.25f-30, 25), Speed, 0.0f, 2.0f);
					//Health
					float Health=creatureScript.Health;
					GUI.Box(new Rect(10, 160, sw*0.25f-30, 25), "Health : "+Mathf.Round(Health*10)/10);
					Health=GUI.HorizontalSlider(new Rect(10, 180, sw*0.25f-30, 25), creatureScript.Health, 0, 100); creatureScript.Health =Health;
					//Food
					float Food=creatureScript.Food;
					GUI.Box(new Rect(10, 200, sw*0.25f-30, 20), "Food : "+Mathf.Round(Food*10)/10);
					Food=GUI.HorizontalSlider(new Rect(10, 220, sw*0.25f-30, 20), creatureScript.Food, 0, 100); creatureScript.Food =Food;

					if(!creatureScript.CanSwim)
					{
						//Water
						float Water=creatureScript.Water;
							GUI.Box(new Rect(10, 240, sw*0.25f-30, 20), "Water : "+Mathf.Round(Water*10)/10);
						Water=GUI.HorizontalSlider(new Rect(10, 260, sw*0.25f-30, 20), creatureScript.Water, 0, 100); creatureScript.Water =Water;
						//Fatigue
						float Fatigue=creatureScript.Fatigue;
						GUI.Box(new Rect(10, 280, sw*0.25f-30, 20), "Fatigue : "+Mathf.Round(Fatigue*10)/10);
						Fatigue=GUI.HorizontalSlider(new Rect(10, 300, sw*0.25f-30, 20), creatureScript.Fatigue, 0, 100); creatureScript.Fatigue =Fatigue;
					}
					else
					{
						GUI.Box(new Rect(10, 240, sw*0.25f-30, 20), "Water : N/A");
						GUI.Box(new Rect(10, 280, sw*0.25f-30, 20), "Fatigue : N/A");
					}

					//Damage
					float Damage=creatureScript.DamageMultiplier;
						GUI.Box(new Rect(10, 320, sw*0.25f-30, 20), "Damages X"+Mathf.Round(creatureScript.DamageMultiplier*100)/100);
					Damage=GUI.HorizontalSlider(new Rect(10, 340, sw*0.25f-30, 20), creatureScript.DamageMultiplier, 1, 10); creatureScript.DamageMultiplier=Damage;
					//Armor
					float Armor=creatureScript.ArmorMultiplier;
						GUI.Box(new Rect(10, 360, sw*0.25f-30, 20), "Armor X"+Mathf.Round(creatureScript.ArmorMultiplier*100)/100);
					Armor=GUI.HorizontalSlider(new Rect(10, 380, sw*0.25f-30, 20), creatureScript.ArmorMultiplier, 1, 10); creatureScript.ArmorMultiplier=Armor;

					GUI.EndScrollView();

				}
			}
			else GUI.Box (new Rect(0, 50, sw*0.25f, (sh*0.75f)-50), "None", style);


			//Add new creature
			GUI.color=Color.yellow;
			if(addCreatureTab==-2)
			{
				if(GUI.Button (new Rect(0, sh*0.75f, sw*0.25f, 25), "")) addCreatureTab=-1;
				GUI.Box(new Rect(0, sh*0.75f, sw/4, sh/4), "Add a new creature", style);
			}
			else if(addCreatureTab==-1)
			{
				if(GUI.Button (new Rect(0, sh*0.75f, sw*0.25f, 25), "")) addCreatureTab=-2;
				GUI.Box(new Rect(0, sh*0.75f, sw/4, sh/4), "Cancel", style);
				GUI.Box(new Rect(sw/4, 50, sw*0.75f, sh-50), "Select a specie", style);
				scroll2 = GUI.BeginScrollView(new Rect(sw/4, sh/4, sw*0.75f, sh*0.75f), scroll2, new Rect(0, 0, 740, 290));

				//Volume I
				GUI.color=Color.yellow; GUI.Box(new Rect(25, 0, 140, 25), "Vol. I", style);
					CheckCollection("Ankylosaurus", new Rect(25, 30, 140, 20));
					CheckCollection("Brachiosaurus", new Rect(25, 50, 140, 20));
					CheckCollection("Compsognathus", new Rect(25, 70, 140, 20));
					CheckCollection("Dilophosaurus", new Rect(25, 90, 140, 20));
					CheckCollection("Dimetrodon", new Rect(25, 110, 140, 20));
					CheckCollection("Oviraptor", new Rect(25, 130, 140, 20));
					CheckCollection("Parasaurolophus", new Rect(25, 150, 140, 20));
					CheckCollection("Pteranodon", new Rect(25, 170, 140, 20));
					CheckCollection("Spinosaurus", new Rect(25, 190, 140, 20));
					CheckCollection("Stegosaurus", new Rect(25, 210, 140, 20));
					CheckCollection("Triceratops", new Rect(25, 230, 140, 20));
					CheckCollection("Tyrannosaurus Rex", new Rect(25, 250, 140, 20));
					CheckCollection("Velociraptor", new Rect(25, 270, 140, 20));
				//Volume II
				GUI.color=Color.yellow; GUI.Box(new Rect(170, 0, 140, 25), "Vol. II", style);
					CheckCollection("Argentinosaurus", new Rect(170, 30, 140, 20));
					CheckCollection("Baryonyx", new Rect(170, 50, 140, 20));
					CheckCollection("Carnotaurus", new Rect(170, 70, 140, 20));
					CheckCollection("Dimorphodon", new Rect(170, 90, 140, 20));
					CheckCollection("Gallimimus", new Rect(170, 110, 140, 20));
					CheckCollection("Iguanodon", new Rect(170, 130, 140, 20));
					CheckCollection("Kentrosaurus", new Rect(170, 150, 140, 20));
					CheckCollection("Ouranosaurus", new Rect(170, 170, 140, 20));
					CheckCollection("Pachycephalosaurus", new Rect(170, 190, 140, 20));
					CheckCollection("Protoceratops", new Rect(170, 210, 140, 20));
					CheckCollection("Quetzalcoatlus", new Rect(170, 230, 140, 20));
					CheckCollection("Styracosaurus", new Rect(170, 250, 140, 20));
					CheckCollection("Troodon", new Rect(170, 270, 140, 20));
				//Volume III
				GUI.color=Color.yellow; GUI.Box(new Rect(315, 0, 140, 25), "Vol. III", style);
					CheckCollection("Acrocanthosaurus", new Rect(315, 30, 140, 20));
					CheckCollection("Allosaurus", new Rect(315, 50, 140, 20));
					CheckCollection("Amargasaurus", new Rect(315, 70, 140, 20));
					CheckCollection("Apatosaurus", new Rect(315, 90, 140, 20));
					CheckCollection("Archaeopteryx", new Rect(315, 110, 140, 20));
					CheckCollection("Ceratosaurus", new Rect(315, 130, 140, 20));
					CheckCollection("Corythosaurus", new Rect(315, 150, 140, 20));
					CheckCollection("Ornithocheirus", new Rect(315, 170, 140, 20));
					CheckCollection("Pachyrhinosaurus", new Rect(315, 190, 140, 20));
					CheckCollection("Postosuchus", new Rect(315, 210, 140, 20));
					CheckCollection("Proganochelys", new Rect(315, 230, 140, 20));
					CheckCollection("Psittacosaurus", new Rect(315, 250, 140, 20));
					CheckCollection("Therizinosaurus", new Rect(315, 270, 140, 20));
				//Volume IV
				GUI.color=Color.yellow; GUI.Box(new Rect(460, 0, 140, 25), "Vol. IV", style);
					CheckCollection("Ammonite", new Rect(460, 30, 140, 20));
					CheckCollection("Anomalocaris", new Rect(460, 50, 140, 20));
					CheckCollection("Archelon", new Rect(460, 70, 140, 20));
					CheckCollection("Dunkleosteus", new Rect(460, 90, 140, 20));
					CheckCollection("Giant Orthocone", new Rect(460, 110, 140, 20));
					CheckCollection("Helicoprion", new Rect(460, 130, 140, 20));
					CheckCollection("Ichthyosaur", new Rect(460, 150, 140, 20));
					CheckCollection("Leedsichthys", new Rect(460, 170, 140, 20));
					CheckCollection("Mosasaurus", new Rect(460, 190, 140, 20));
					CheckCollection("Onchopristis", new Rect(460, 210, 140, 20));
					CheckCollection("Sarcosuchus", new Rect(460, 230, 140, 20));
					CheckCollection("Styxosaurus", new Rect(460, 250, 140, 20));
					CheckCollection("Xenacanthus", new Rect(460, 270, 140, 20));
				//Volume V 
				GUI.color=Color.yellow; GUI.Box(new Rect(605, 0, 140, 25), "Vol. V", style);
					CheckCollection("Arthropleura", new Rect(605, 30, 140, 20));
					CheckCollection("Coelacanth", new Rect(605, 50, 140, 20));
					CheckCollection("Cynognathus", new Rect(605, 70, 140, 20));
					CheckCollection("Diplocaulus", new Rect(605, 90, 140, 20));
					CheckCollection("Euphoberia", new Rect(605, 110, 140, 20));
					CheckCollection("Koolasuchus", new Rect(605, 130, 140, 20));
					CheckCollection("Meganeuropsis", new Rect(605, 150, 140, 20));
					CheckCollection("Megazostrodon", new Rect(605, 170, 140, 20));
					CheckCollection("Nephila Jurassica", new Rect(605, 190, 140, 20));
					CheckCollection("Palaeocharinus", new Rect(605, 210, 140, 20));
					CheckCollection("Proceratocephala", new Rect(605, 230, 140, 20));
					CheckCollection("Pulmonoscorpius", new Rect(605, 250, 140, 20));
					CheckCollection("Stethacanthus", new Rect(605, 270, 140, 20));
				GUI.EndScrollView();
			}
			else
			{
				if(GUI.Button (new Rect(0, sh*0.75f, sw*0.25f, 25), "")) { addCreatureTab=-1; return; }
				GUI.Box(new Rect(0, sh*0.75f, sw/4, sh/4), "Select Creature : "+CollectionList[addCreatureTab].name, style);
				GUI.color=Color.white;
				scroll2 = GUI.BeginScrollView(new Rect(0,  (sh*0.75f)+40, sw*0.25f, (sh*0.25f)-40), scroll2, new Rect(0, 0, 0, 130), false, true);

				//AI
				GUI.Box(new Rect(10, 0, sw*0.25f-30, 25), "");
				spawnAI= GUI.Toggle (new Rect(18, 0, 120, 25), spawnAI, " Spawn with AI ");
				//Random
				GUI.Box(new Rect(10, 30, sw*0.25f-30, 25), "");
				rndSkin= GUI.Toggle (new Rect(18, 30, 100, 25), rndSkin, " Random skin");
				//Random size
				GUI.Box(new Rect(10, 60, sw*0.25f-30, 25), "");
				rndSize= GUI.Toggle (new Rect(18, 60, 100, 25), rndSize, " Random size");
				if(rndSize)
				{
						if(GUI.Button(new Rect(130, 60, sw*0.25f-150, 25), "Span : "+rndSizeSpan.ToString()))
					{ if(rndSizeSpan<5) rndSizeSpan++; else rndSizeSpan=1; }
				}
				//Random setting
				GUI.Box(new Rect(10, 90, sw*0.25f-30, 25), "");
				rndSetting= GUI.Toggle (new Rect(18, 90, sw*0.25f-30, 25), rndSetting, " Random health settings");

				GUI.EndScrollView();

				//Spawn new creature
				if(GUI.Button (new Rect(sw*0.6f, sh/2, 80, 60), "SPAWN !"))
				{
					GameObject spawncreature = Instantiate(CollectionList[addCreatureTab] ,transform.position+transform.forward*10, Quaternion.identity);
					shared script=spawncreature.GetComponent<shared>();

					if(!spawnAI) CameraMode=1; script.AI=spawnAI;
					if(rndSkin) { script.SetMaterials(Random.Range(0, 3), Random.Range(0, 16)); }
					if(rndSize) { script.SetScale( 0.5f+Random.Range((float) rndSizeSpan/-10, (float) rndSizeSpan/10)); } else script.SetScale(0.5f);
					if(rndSetting)
					{
						script.Health =Random.Range(25,100); script.Fatigue =Random.Range(25,100);
						script.Food =Random.Range(25,100); script.Water =Random.Range(25,100);
					}

						spawncreature.name=CollectionList[addCreatureTab].name;
					creaturesList.Add(spawncreature.gameObject); selected = creaturesList.IndexOf(spawncreature.gameObject); //add creature to creature list
				}
			}
			break;
			//Options
			case 2: 
			GUI.Box (new Rect(0, 50, sw, sh-50), "Options", style);
			//Screen
			GUI.Box(new Rect((sw/2)-225, (sh/2)-110, 150, 220), "Screen", style);
			bool fullScreen=Screen.fullScreen; fullScreen= GUI.Toggle (new Rect((sw/2)-220, (sh/2)-80, 140, 20), fullScreen, " Fullscreen");
			if(fullScreen!=Screen.fullScreen) Screen.fullScreen=!Screen.fullScreen;
			ShowFPS= GUI.Toggle (new Rect((sw/2)-220, (sh/2)-40, 140, 20), ShowFPS, " Show Fps");
			ShowGUI= GUI.Toggle (new Rect((sw/2)-220, (sh/2), 140, 20), ShowGUI, " Show GUI");
			//Controls
			GUI.Box(new Rect((sw/2)-75, (sh/2)-110, 150, 220), "Controls", style);
			InvertYAxis = GUI.Toggle (new Rect((sw/2)-70, (sh/2)-80, 140, 20), InvertYAxis, " Invert Y Axe");
			GUI.Label(new Rect((sw/2)-70, (sh/2)-40, 140, 20), "Sensivity");
			sensivity=GUI.HorizontalSlider(new Rect((sw/2)-70, (sh/2), 140, 20), sensivity, 0.1f, 10.0f);
			//Creatures
			GUI.Box(new Rect((sw/2)+75, (sh/2)-110, 150, 220), "Creatures", style);
			UseIK= GUI.Toggle (new Rect((sw/2)+80, (sh/2)-80, 140, 20), UseIK, " Use IK");
			UseRaycast= GUI.Toggle (new Rect((sw/2)+80, (sh/2)-40, 140, 20), UseRaycast, " Use Raycast");
			RealtimeGame= GUI.Toggle (new Rect((sw/2)+80, (sh/2), 140, 20), RealtimeGame, " Realtime Game");
			break;
			//Help
			case 3: GUI.Box (new Rect(0, 50, sw, sh-50), "Controls", style);	
				GUI.DrawTexture(new Rect(0, 50, sw, sh-50), helpscreen); 
			break;
			}
		} else Cursor.visible = false;


		if(creatureScript)
		{
			if(ShowGUI)
			{
				// Health bar
				if(CameraMode==1)
				{
					Rect ico1 = new Rect(0, 0.5f, 0.5f, 0.5f), ico2 = new Rect(0.5f, 0.5f, 0.5f, 0.5f), ico3 = new Rect(0.5f, 0, 0.5f, 0.5f), ico4 =new Rect(0, 0, 0.5f, 0.5f), bar=new Rect(0, 0, 0.1f, 0.1f);
					GUI.color=Color.white; //Icons
					GUI.DrawTextureWithTexCoords(new Rect(sw/4, sh/1.1f, sw/48, sw/48), icons, ico1, true);  //health icon
					GUI.DrawTextureWithTexCoords(new Rect(sw/2, sh/1.1f, sw/48, sw/48), icons, ico2, true); //food icon
					if(!creatureScript.CanSwim)
					{
						GUI.DrawTextureWithTexCoords(new Rect(sw/2, sh/1.05f, sw/48, sw/48), icons, ico3, true); //water icon
						GUI.DrawTextureWithTexCoords(new Rect(sw/4, sh/1.05f, sw/48, sw/48), icons, ico4, true); //sleep icon
					}
					GUI.color=Color.black; //bar background
					GUI.DrawTextureWithTexCoords(new Rect(sw/3.5f, sh/1.09f, (sw*0.002f)*100, sh/100), icons, bar, false);
					GUI.DrawTextureWithTexCoords(new Rect(sw/1.85f, sh/1.09f, (sw*0.002f)* 100, sh/100), icons, bar, false);
					if(!creatureScript.CanSwim)
					{
						GUI.DrawTextureWithTexCoords(new Rect(sw/1.85f, sh/1.04f, (sw*0.002f)*100, sh/100), icons, bar, false); 
						GUI.DrawTextureWithTexCoords(new Rect(sw/3.5f, sh/1.04f, (sw*0.002f)*100, sh/100), icons, bar, false);
					}
					GUI.color=Color.green; //health bar
					GUI.DrawTextureWithTexCoords(new Rect(sw/3.5f, sh/1.09f, (sw*0.002f)*creatureScript.Health, sh/100), icons, bar, false);
					GUI.color=Color.yellow; //food bar
					GUI.DrawTextureWithTexCoords(new Rect(sw/1.85f, sh/1.09f, (sw*0.002f)*creatureScript.Food, sh/100), icons, bar, false);
					if(!creatureScript.CanSwim)
					{
						GUI.color=Color.cyan; //water bar
						GUI.DrawTextureWithTexCoords(new Rect(sw/1.85f, sh/1.04f, (sw*0.002f)*creatureScript.Water, sh/100), icons, bar, false);
						GUI.color=Color.gray; //sleep bar
						GUI.DrawTextureWithTexCoords(new Rect(sw/3.5f, sh/1.04f, (sw*0.002f)*creatureScript.Fatigue, sh/100), icons, bar, false);
					}
				}
			}
		}

		//Fps
		GUI.color=Color.white;
		if(ShowFPS) GUI.Label(new Rect(sw-60, 1, 55, 20), "Fps : "+ fps);

		//Messages
		if(message!=0)
		{
			count++;
			if(message==1) GUI.Box(new Rect((sw/2)-120, sh/2, 240, 25), "Nothing to eat or drink...", style);
			else if(message==2)  GUI.Box(new Rect((sw/2)-200, sh/2, 400, 25), "AI and IK features require 'JP Script Extension Asset' ", style);
			if(count==512) { count=0; message=0; }
		}
	}