public override void Start()
    {
        grid = FindObjectOfType <BluetoothGrid>();
        bluetoothEventListener = FindObjectOfType <BluetoothEventListener>();

        scoring    = FindObjectOfType <ScoringScript>();
        serverType = Cell.CellOcc.X;
        whoseTurn  = Cell.CellOcc.X;

        SomeoneWonGameEvent += SomeOneWonGame;
    }
Ejemplo n.º 2
0
    /// <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(); });
    }
Ejemplo n.º 3
0
    /// <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(); });
    }