Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        //create the terrain outline (different at each game)
        outline = terrain.GetComponent <createOutline>();
        outline.createTerrain();
        cannons_Outline = cannons.GetComponent <cannonsOutline>();
        cannons_Outline.createCannons(outline);

        currentCannon = cannons_Outline.getCannon1Renderer();
        groundPos     = outline.getPosition(10, true); //cannon1 is at pt 10

        //call every 2s the wind method to generate new value
        InvokeRepeating("WindChanges", 1.0f, 2.0f);

        //display the initial values of wind and velocity
        velocityTxt      = GameObject.Find("veloText").GetComponent <Text>();
        windTxt          = GameObject.Find("windText").GetComponent <Text>();
        velocityTxt.text = "Muzzle velocity : " + muzzleVelocity.ToString();
        windTxt.text     = "Wind  : " + wind.ToString();
    }