Example #1
0
    public async void SensorSpawn()
    {
        Sensor1 m = await APIService.Instance.Server1RandNum();

        int oldTriggers1 = m.sensor1;

        Debug.Log(m);

        Sensor2 o = await APIService.Instance.Server2RandNum();

        int oldTriggers2 = o.sensor2;

        Debug.Log(0);

        StartCoroutine(timer());

        Sensor1 n = await APIService.Instance.Server1RandNum();

        int newTriggers1 = n.sensor1;

        Sensor2 p = await APIService.Instance.Server2RandNum();

        int newTriggers2 = p.sensor2;

        if (oldTriggers1 != newTriggers1 || oldTriggers2 != newTriggers2)
        {
            SpawnWisp();
        }
    }
Example #2
0
    public async Task <Sensor1> Server1RandNum()
    {
        string url            = "HTTP://192.168.1.4";
        string responseString = await _client.GetStringAsync(url);

        Sensor1 i = JsonConvert.DeserializeObject <Sensor1>(responseString);

        return(i);
    }