Синтаксис:
Используется javascript
var beep : AudioClip;
var menuSkin : GUISkin;
var areaWidth : float;
var areaHeight : float;
var PlayScene = "playscene";
var InstrScene = "instr";
var PripX = 0;
var PripY = 30;
function OnGUI(){
GUI.skin = menuSkin;
var ScreenX = ((Screen.width * 0.5) - (areaWidth * 0.5));
var ScreenY = ((Screen.height * 0.5) - (areaHeight * 0.5));
var windowRect = Rect (ScreenX+PripX,ScreenY+PripY, areaWidth, areaHeight);
windowRect = GUI.Window (0, windowRect, DoMyWindow, "Game");
}
function OpenLevel(level : String){
audio.PlayOneShot(beep);
yield new WaitForSeconds(0.35);
Application.LoadLevel(level);
}
function DoMyWindow (windowID : int) {
var ScreenX = ((Screen.width * 0.5) - (areaWidth * 0.5));
var ScreenY = ((Screen.height * 0.5) - (areaHeight * 0.5));
GUILayout.BeginArea (Rect (PripX,PripY, areaWidth, areaHeight));
if (Application.platform == RuntimePlatform.OSXWebPlayer || Application.platform == RuntimePlatform.WindowsWebPlayer){
if(GUILayout.Button ("Start game")){
OpenLevel(PlayScene);
}
if(GUILayout.Button ("Instructions")){
OpenLevel(InstrScene);
}
}else{
if(GUILayout.Button ("Start Game")){
OpenLevel(PlayScene);
}
if(GUILayout.Button ("Instructions")){
OpenLevel(InstrScene);
}
if(GUILayout.Button ("Quit")){
Application.Quit();
}
}
GUILayout.EndArea();
GUI.DragWindow ();
}
@script RequireComponent(AudioSource)
var menuSkin : GUISkin;
var areaWidth : float;
var areaHeight : float;
var PlayScene = "playscene";
var InstrScene = "instr";
var PripX = 0;
var PripY = 30;
function OnGUI(){
GUI.skin = menuSkin;
var ScreenX = ((Screen.width * 0.5) - (areaWidth * 0.5));
var ScreenY = ((Screen.height * 0.5) - (areaHeight * 0.5));
var windowRect = Rect (ScreenX+PripX,ScreenY+PripY, areaWidth, areaHeight);
windowRect = GUI.Window (0, windowRect, DoMyWindow, "Game");
}
function OpenLevel(level : String){
audio.PlayOneShot(beep);
yield new WaitForSeconds(0.35);
Application.LoadLevel(level);
}
function DoMyWindow (windowID : int) {
var ScreenX = ((Screen.width * 0.5) - (areaWidth * 0.5));
var ScreenY = ((Screen.height * 0.5) - (areaHeight * 0.5));
GUILayout.BeginArea (Rect (PripX,PripY, areaWidth, areaHeight));
if (Application.platform == RuntimePlatform.OSXWebPlayer || Application.platform == RuntimePlatform.WindowsWebPlayer){
if(GUILayout.Button ("Start game")){
OpenLevel(PlayScene);
}
if(GUILayout.Button ("Instructions")){
OpenLevel(InstrScene);
}
}else{
if(GUILayout.Button ("Start Game")){
OpenLevel(PlayScene);
}
if(GUILayout.Button ("Instructions")){
OpenLevel(InstrScene);
}
if(GUILayout.Button ("Quit")){
Application.Quit();
}
}
GUILayout.EndArea();
GUI.DragWindow ();
}
@script RequireComponent(AudioSource)