- Home /
Question by
Blackice000 · Nov 15, 2011 at 07:03 PM ·
c#guipause
Pause Menu problem
I have a pause menu, but I can't seem to be able to access a way to put in the code necessary to check if the mouse is on a button or in the text of that button and send it an action if clicked on that (need event on mouseover, exit, up).
the code is as following: using System; using UnityEngine;
public class PauseMenu : MonoBehaviour { public static bool paused = false; public Texture menu; public Texture button; public Font Paused; public Font AllRest; Color LastColor;
void OnGUI()
{
if (paused)
{
GUI.DrawTexture(new Rect(70, 45, 640, 480), menu, ScaleMode.ScaleToFit, true, 0.0f);
LastColor = GUI.color;
GUI.color = new Color(0.65f, 0.0f, 0.0f, 1.0f);
GUI.skin.label.font = Paused;
GUI.skin.label.fontSize = 150;
GUI.Label(new Rect(260, 95, 300, 200), "Pausado");
GUI.color = LastColor;
GUI.DrawTexture(new Rect(95, 250, 580, 60), button, ScaleMode.ScaleToFit, true, 0.0f);
GUI.DrawTexture(new Rect(95, 320, 580, 60), button, ScaleMode.ScaleToFit, true, 0.0f);
GUI.DrawTexture(new Rect(95, 390, 580, 60), button, ScaleMode.ScaleToFit, true, 0.0f);
GUI.color = new Color(0.65f, 0.0f, 0.0f, 1.0f);
GUI.skin.label.font = AllRest;
GUI.skin.label.fontSize = 37;
GUI.Label(new Rect(250, 261, 300, 100), "Retornar ao Jogo");
GUI.Label(new Rect(290, 331, 250, 100), "Salvar Jogo");
GUI.Label(new Rect(260, 401, 300, 100), "Voltar ao Menu");
}
}
public static bool togglePause()
{
if (Time.timeScale == 0f)
{
Time.timeScale = 1f;
TP_Controller.CanMove = true;
TP_Controller.isAttacking = false;
return (false);
}
else
{
Time.timeScale = 0f;
TP_Controller.CanMove = false;
TP_Controller.isAttacking = true;
return (true);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Way to have a pause and play texture in same GUI texture? 0 Answers
GUI objects jitter when following "lerped" Gameobject [SOLVED] 1 Answer
GUI health status 1 Answer