コード例 #1
0
ファイル: MatrixTest.cs プロジェクト: hueblerw/CavemanGame4
    public void TimeTheTempEqCreation()
    {
        Stopwatch sw = Stopwatch.StartNew();

        sw.Start();
        TempEquation tempEq = new TempEquation(70, 20, 56, 6.0);

        sw.Stop();
        UnityEngine.Debug.Log("Temp Eq constructor took " + sw.Elapsed + " secs to run.");
    }
コード例 #2
0
ファイル: MatrixTest.cs プロジェクト: hueblerw/CavemanGame4
    public void TimeTheTempEqReturnDaysTemp()
    {
        TempEquation tempEq = new TempEquation(70, 20, 56, 6.0);
        Stopwatch    sw     = Stopwatch.StartNew();

        sw.Start();
        tempEq.generateTodaysTemp(45, new System.Random());
        sw.Stop();
        UnityEngine.Debug.Log("Temp Eq generateTodaysTemp took " + sw.Elapsed + " secs to run.");
    }
コード例 #3
0
ファイル: Tile.cs プロジェクト: hueblerw/CavemanGame4
 public Tile(double elevation, double lowTemp, double highTemp, double midpoint, double variance, Humidity humidity)
 {
     this.elevation = Math.Round(elevation, 2);
     this.lowTemp   = (int)Math.Round(lowTemp, 0);
     this.highTemp  = (int)Math.Round(highTemp, 0);
     this.midpoint  = Math.Round(midpoint, 1);
     this.variance  = Math.Round(variance, 2);
     this.humidity  = humidity;
     // Use the above to generate the secondary the tempEq - THIS IS THE TASK THAT TAKES SOME TIME IN INITIAL GENERATION.
     tempEquation = new TempEquation(this.highTemp, this.lowTemp, midpoint, variance);
     randy        = new System.Random();
     localwater   = new LocalWater();
 }
コード例 #4
0
    // World Array Initializer

    public void createEquations(SingleValueLayer highTemp, SingleValueLayer lowTemp, SingleValueLayer tempMidpt, SingleValueLayer variance)
    {
        // Basically, loop through the creation of each individual equation
        TempEquation temporary;

        TempEquation[,] tempArray = new TempEquation[EquationLayer.WORLDX, EquationLayer.WORLDZ];
        for (int x = 0; x < WORLDX; x++)
        {
            for (int z = 0; z < WORLDZ; z++)
            {
                temporary       = new TempEquation((int)highTemp.worldArray[x, z], (int)lowTemp.worldArray[x, z], tempMidpt.worldArray[x, z], variance.worldArray[x, z]);
                tempArray[x, z] = temporary;
            }
        }
        this.worldArray = tempArray;
    }
コード例 #5
0
ファイル: ClassTester.cs プロジェクト: hueblerw/CavemanWorld
    public void TempEquationTest()
    {
        // Test the TempEquation
        TempEquation testEquation = new TempEquation(80, 20, (float)25.0, (float)6.0);

        // Test the TempEquation Constructor
        Assert.AreEqual(0.0, testEquation.returnConstants()[0], 0.01);
        Assert.AreEqual(-26.25, testEquation.returnConstants()[1], 0.1);
        Assert.AreEqual(52.51, testEquation.returnConstants()[2], 0.1);
        Assert.AreEqual(-31.51, testEquation.returnConstants()[3], 0.1);
        Assert.AreEqual(5.25, testEquation.returnConstants()[4], 0.1);
        Assert.AreEqual(1.0, testEquation.returnConstants()[5], 0.1);

        // Test the yearly temperature generation
        Assert.AreEqual(20.0, testEquation.generateYearsTemps().days[0], 6.0);
        Assert.AreEqual(58.6, testEquation.generateYearsTemps().days[29], 6.0);
        Assert.AreEqual(80.0, testEquation.generateYearsTemps().days[59], 6.0);
        Assert.AreEqual(58.6, testEquation.generateYearsTemps().days[89], 6.0);
    }