// Use this for initialization void Start() { Script = this; scriptSysDetection = this.GetComponent <MiscSysDetection>(); if (!scriptSysDetection) { // DEBUG Debug.LogError("Failed to find the MiscSysDetection component."); } CheckJoysticks(); // FIXME: now working only for XBox 360 gamepads //SetupXBox360Gamepad(); SetupJoysticksAxis(); }
/// <summary> /// Start will execute when an object with it is instantiated /// </summary> void Start() { // Object for the gamepad detection script scriptGamepad = GameObject.Find("/GameCode").GetComponent <GamepadDetection>(); if (!scriptGamepad) { // DEBUG Debug.LogError("Gamepad object controller not found."); } // Get the screen size v2ScreenCenter.x = Screen.width * 0.5f; v2ScreenCenter.y = Screen.height * 0.5f; // Do we have a gamepad attached? if (Input.GetJoystickNames().Length == 0) { bnUseMouse = true; } else { bnUseGamepad = true; } // trLevel = GameObject.Find("Level").transform; trCameraPivot = GameObject.Find("CameraPivot").transform; // Population Bar scriptPopulationBar = GetComponent <GUIOnGameHUD>(); // Populate the level PopulateLevelWithEnemies(nNumberOfEnemies); PopulateLevelWithCannons(nNumberOfCannons); // Starts the DelayedStart coroutine StartCoroutine(DelayedStart()); if (audio) { audio.Play(); } myCamera = Camera.main.camera; }