Quick explanation of what I did and why.
How can I do it better or what would be a better way of scripting a map?
I have a building that has multiple rooms 16. I put a trigger collider in each room (that has the script below attached to each trigger), so that when the player Clicks on the “M” key the map will popup Showing where the player currently is. The Problem Im noticing is when I click on the M key its not responding every frame (or quick enough)? And I dont really know of any other way to do it? So any suggestions would really be welcomed.
After getting this straightened out I also need a way to place a texture on the map of where I’ve been???
var DisplayMapBackground = false;
var MapSkin : GUISkin;
var MapBackground : Texture2D;
var youAreHere : Texture2D;
var missionEnd : Texture2D;
var beenHereBefore : Texture2D;//dont know how to do this yet???
var DisplayYouAreHere = false;
var DisplayMissionEnd = false;
var areHereX : int = 0;
var areHereY : int = 0;
var endX : int = 0;
var endY : int = 0;
function OnTriggerStay(Map : Collider)
{
if(Map.gameObject.name == "Robot")
{
if(Input.GetKeyDown(KeyCode.M))
{
DisplayMapBackground = true;
DisplayYouAreHere = true;
DisplayMissionEnd = true;
//make other Gui Health bars to show false
}
}
}
function OnGUI()
{
GUI.skin = MapSkin;
if( DisplayMapBackground )
{
//GUI Background Image KeyFound
GUI.Label (Rect (0,0, 600,450), MapBackground, GUIStyle.none);
//pause game somehow
//Ok Button Change the size 152 x 51
if (GUI.Button (Rect (65, 390, 152,51), "","Ok"))
{
DisplayMapBackground = false;
DisplayYouAreHere = false;
DisplayMissionEnd = false;
//unpausegame somehow
//show other gui health bars to true
}
if (GUI.Button (Rect (400, 390, 152,51), "", "Invite"))
{
//Intvite button code
}
}
if(DisplayYouAreHere)
{
GUI.Label (Rect (areHereX,areHereY, 29,29), youAreHere, GUIStyle.none);
}
if(DisplayMissionEnd)
{
GUI.Label (Rect (endX,endY, 29,29), missionEnd, GUIStyle.none);
}
}
