/////////////////////////////////////////////////////////////////////////////// // functions /////////////////////////////////////////////////////////////////////////////// // ------------------------------------------------------------------ // Desc: // ------------------------------------------------------------------ void Awake () { if( instance == null ) { instance = this; // check if we have main menu options, and apply the options. GameObject options = GameObject.Find("MainMenuOptions"); if ( options ) { instance.multiPlayer = options.GetComponent<MainMenuOptions>().isMultiPlayer; Debug.Log("multi player = " + instance.multiPlayer ); GameObject.Destroy(options); } // GameObject goBoy = GameObject.FindWithTag("player_boy"); playerBoy = goBoy.GetComponent<PlayerBase>(); GameObject goGirl = GameObject.FindWithTag("player_girl"); playerGirl = goGirl.GetComponent<PlayerBase>(); // if ( startPoints.Length != 0 ) { int i = (int)(Random.value * (startPoints.Length-1)); PlacePlayerAtStartPoint(this.startPoints[i].transform); } else { Debug.LogError("Can't find start point"); } // init hud if ( screenPad == null ) { GameObject hud = null; hud_m.SetActiveRecursively(false); hud_s.SetActiveRecursively(false); if ( Game.IsMultiPlayer() ) hud = hud_m; else hud = hud_s; hud.SetActiveRecursively(true); if ( hud ) { screenPad = hud.GetComponent<ScreenPad>(); screenPad.Init(); } #if UNITY_IPHONE if ( Application.isEditor == false ) { DebugHelper.Assert( screenPad, "screenPad not found" ); } #endif } } }