Ejemplo n.º 1
0
 /// <summary>
 /// Sets the current LandTerrain to the given parameter of aLandTerrain
 /// </summary>
 /// <param name="aLandTerrain"></param>
 void SetCurrentTerrain(LandTerrain aLandTerrain)
 {
     //When called, will set the terrain to the specific terrain given
     //Will also set the parallax background to what the terrain has
     ltCurrentTerrain = aLandTerrain;
     //sprParallaxBackground = ltCurrentTerrain.sprSprite;
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Returns a specific LandTerrain class based on the value of parameter iRange
    /// </summary>
    /// <param name="iRange"></param>
    /// <returns></returns>
    LandTerrain SelectNewTerrain(int iRange)
    {
        //Select a new terrain
        LandTerrain tempTerrain = new LandTerrain();

        //Might randomize which Terrain the tempTerrain will be
        // Different terrain weighted differently

        switch (iRange)
        {
        case 0:     //Forest
            tempTerrain = new Forest();
            return(tempTerrain);

        case 1:     //Grassland
            tempTerrain = new Grassland();
            return(tempTerrain);

        case 2:     //Lake
            tempTerrain = new Lake();
            return(tempTerrain);

        case 3:     //Mountain
            tempTerrain = new Mountain();
            break;

        case 4:     //Desert
            tempTerrain = new Desert();
            break;

        case 5:     //Swamp
            tempTerrain = new Swamp();
            break;

        case 6:     //Tundra
            tempTerrain = new Tundra();
            break;

        case 7:     //Jungle
            tempTerrain = new Jungle();
            break;

        case 8:     //Wasteland
            tempTerrain = new Wasteland();
            break;
        }


        return(tempTerrain);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Initializes the Lists of Weather and LandTerrain, and randomly assigns values
    /// Assigns the index 0 to the currentWeather and currentTerrain, respectively.
    /// </summary>
    void SetupForecast()
    {
        //Sets the current weather and current terrain in one go
        // For now can set it just to the first, until I can think
        // of a better way to do so

        //Will set up to know what weather is at least three spaces ahead
        int         iTempNum      = Random.Range(0, iTERRAINTYPEAMOUNT);
        LandTerrain ltTempTerrain = new LandTerrain();

        for (int i = 0; i < iForecastLength; i++)
        {
            switch (iTempNum)
            {
            case 0:     //Forest
                ltTempTerrain = SelectNewTerrain(0);
                wObjs.Add(SelectNewWeather(ltTempTerrain));
                ltObjs.Add(ltTempTerrain);
                break;

            case 1:     //Grassland
                ltTempTerrain = SelectNewTerrain(1);
                wObjs.Add(SelectNewWeather(ltTempTerrain));
                ltObjs.Add(ltTempTerrain);
                break;

            case 2:     //Lake
                ltTempTerrain = SelectNewTerrain(2);
                wObjs.Add(SelectNewWeather(ltTempTerrain));
                ltObjs.Add(ltTempTerrain);
                break;

            case 3:     //Mountain
                ltTempTerrain = SelectNewTerrain(3);
                wObjs.Add(SelectNewWeather(ltTempTerrain));
                ltObjs.Add(ltTempTerrain);
                break;

            case 4:     //Desert
                ltTempTerrain = SelectNewTerrain(4);
                wObjs.Add(SelectNewWeather(ltTempTerrain));
                ltObjs.Add(ltTempTerrain);
                break;

            case 5:     //Swamp
                ltTempTerrain = SelectNewTerrain(5);
                wObjs.Add(SelectNewWeather(ltTempTerrain));
                ltObjs.Add(ltTempTerrain);
                break;

            case 6:     //Tundra
                ltTempTerrain = SelectNewTerrain(6);
                wObjs.Add(SelectNewWeather(ltTempTerrain));
                ltObjs.Add(ltTempTerrain);
                break;

            case 7:     //Jungle
                ltTempTerrain = SelectNewTerrain(7);
                wObjs.Add(SelectNewWeather(ltTempTerrain));
                ltObjs.Add(ltTempTerrain);
                break;

            case 8:     //Wasteland
                ltTempTerrain = SelectNewTerrain(8);
                wObjs.Add(SelectNewWeather(ltTempTerrain));
                ltObjs.Add(ltTempTerrain);
                break;
            }
        }

        SetCurrentWeather(wObjs[0]);
        SetCurrentTerrain(ltObjs[0]);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Based on the LandTerrain given, will create and return a new Weather object
    /// </summary>
    /// <param name="aTerrain"></param>
    /// <returns></returns>
    public Weather SelectNewWeather(LandTerrain aTerrain)
    {
        //After a weathereffect is done, select a new weather effect
        // based on the terrain given, so as to only allow certain weather
        Weather wTempWeather = new Weather();

        //Based on the Terrain given, will have a weighted chance as to what weather will
        //be based on what terrain is given. Example: cant be rain in the desert

        //Need to create a basic int array, which will hold the possible choices based on
        //  Index 0 being most likely, and Index 3 being least likely
        int[] iTempArray = new int[4];

        //NOTE: current values inside array of ints is placeholder, once the choices have been finalized,
        //      they will be changed to the appropriate values
        switch (aTerrain.iId)
        {
        case 0:
            iTempArray   = new int[] { 1, 2, 3, 4 };
            wTempWeather = WeatherWeightedRandom(iTempArray);
            return(wTempWeather);

        case 1:
            iTempArray   = new int[] { 1, 2, 3, 4 };
            wTempWeather = WeatherWeightedRandom(iTempArray);
            return(wTempWeather);

        case 2:
            iTempArray   = new int[] { 1, 2, 3, 4 };
            wTempWeather = WeatherWeightedRandom(iTempArray);
            return(wTempWeather);

        case 3:
            iTempArray   = new int[] { 1, 2, 3, 4 };
            wTempWeather = WeatherWeightedRandom(iTempArray);
            return(wTempWeather);

        case 4:
            iTempArray   = new int[] { 1, 2, 3, 4 };
            wTempWeather = WeatherWeightedRandom(iTempArray);
            return(wTempWeather);

        case 5:
            iTempArray   = new int[] { 1, 2, 3, 4 };
            wTempWeather = WeatherWeightedRandom(iTempArray);
            return(wTempWeather);

        case 6:
            iTempArray   = new int[] { 1, 2, 3, 4 };
            wTempWeather = WeatherWeightedRandom(iTempArray);
            return(wTempWeather);

        case 7:
            iTempArray   = new int[] { 1, 2, 3, 4 };
            wTempWeather = WeatherWeightedRandom(iTempArray);
            return(wTempWeather);

        case 8:
            iTempArray   = new int[] { 1, 2, 3, 4 };
            wTempWeather = WeatherWeightedRandom(iTempArray);
            return(wTempWeather);

        default:     //If this occurs, assume error
            return(wTempWeather);
        }
    }