//Update wind attributes of object relative to teh global wind conditions

    void UpdateWindData()
    {
        float tempGWindDir   = globalWindScript.GetGlobalWindDir();
        float tempGWindSpeed = globalWindScript.GetGlobalWindSpeed();

        windSpeed = CalculateStreetWindSpeed(
            tempGWindDir,
            tempGWindSpeed,
            streetDirection,
            streetWidth);

        windDir = CalculateStreetWindDirection(
            tempGWindDir,
            tempGWindSpeed,
            streetDirection,
            streetWidth);

        //Debug.Log("wind speed : " + windSpeed + ", wind direction : "+ windDir);

        Assert.IsTrue(windDir >= 0);
        Assert.IsTrue(windDir <= 360);

        if (logDataToFile)
        {
            string[] vals = { tempGWindDir.ToString(), tempGWindSpeed.ToString(), windDir.ToString(), windSpeed.ToString() };
            logValuesToCSV(vals, logFileName);
        }

        //set wind data vis to new values
        transform.GetChild(0).GetComponent <windVisScript>().setArrow(windSpeed, windDir);
    }
Exemplo n.º 2
0
    void OnMouseDown()
    {
        Vector3 pos = Input.mousePosition;

        pos.z = 10;
        pos   = Camera.main.ScreenToWorldPoint(pos);

        api.SubmitScoutData(new ScoutDataCollector(pos.x, pos.y, globalWindScript.GetGlobalWindSpeed(), globalWindScript.GetGlobalWindDir()));

        Debug.Log("scout data fire at :" + pos.ToString());
    }