/* * This file is part of the "House of the Future" showcase project by M2H (http://www.M2H.nl) * The original author of this code Mike Hergaarden. * Feel free to use this code for your own projects, drop me a line if you made something exciting! */ #pragma strict static var currentMessage : String = ""; static var lastMessageTime : float; public var wiiMote_yes : Texture2D; public var wiiMote_no : Texture2D; public var webcam_yes : Texture2D; public var webcam_no : Texture2D; private var hasWebcam : boolean = false; private var hasWiimote : boolean = false; static function SetMessage(newString : String){ currentMessage=newString; lastMessageTime=Time.time; } function OnGUI () { if(currentMessage!=""){ GUILayout.Label(currentMessage); if(Time.time>lastMessageTime+5){ currentMessage=""; } } GUILayout.BeginVertical(); GUILayout.BeginArea (Rect (0,0, Screen.width, Screen.height)); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if(hasWiimote){ GUILayout.Label(wiiMote_yes); }else{ GUILayout.Label(wiiMote_no); } GUILayout.Space(5); if(hasWebcam){ GUILayout.Label(webcam_yes); }else{ GUILayout.Label(webcam_no); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndArea(); if(!Screen.lockCursor){ GUILayout.BeginArea (Rect (0,0, Screen.width, Screen.height)); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); if(GUILayout.Button("Exit game")){ Application.Quit(); } GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndArea(); } } function HasCamera(){ hasWebcam = true; } function HasWiimote(){ hasWiimote = true; }