public override void Start() { grid = FindObjectOfType <BluetoothGrid>(); bluetoothEventListener = FindObjectOfType <BluetoothEventListener>(); scoring = FindObjectOfType <ScoringScript>(); serverType = Cell.CellOcc.X; whoseTurn = Cell.CellOcc.X; SomeoneWonGameEvent += SomeOneWonGame; }
/// <summary> /// Starts server and starts searching for clients /// </summary> public void StartServer() { // Enable bluetooth if it's not enabled if (!Bluetooth.Instance().IsEnabled()) { SignalToPressBluetoothIcon(); return; } // Make server gameobject and get script bluetoothObject = Instantiate(serverListenerPrefab); bluetoothObject.name = "BluetoothEventListener"; bluetoothScript = bluetoothObject.GetComponent <BluetoothEventListener>(); startPanel.SetActive(false); serverPanel.SetActive(true); // Start search StartSearching(); serverBackStackId = ScaneManager.Instance.AddToBackStack(() => { BackFromServerPanel(); }); }
/// <summary> /// Instantiates client prefab /// </summary> public void StartClient() { // Enable bluetooth if it's not enabled if (!Bluetooth.Instance().IsEnabled()) { SignalToPressBluetoothIcon(); return; } Bluetooth.Instance().Discoverable(); // prefab bluetoothObject = Instantiate(clientListenerPrefab); bluetoothObject.name = "BluetoothEventListener"; bluetoothScript = bluetoothObject.GetComponent <BluetoothEventListener>(); // GUI startPanel.SetActive(false); clientPanel.SetActive(true); clientBackStackId = ScaneManager.Instance.AddToBackStack(() => { BackFromClientPanel(); }); }