Exemplo n.º 1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="LocationWeather" /> class.
        ///     Initializes a new instance of the <see cref="T:TrailSimulation.Core.ModuleProduct" /> class.
        /// </summary>
        /// <param name="climateType">The climate Type.</param>
        public LocationWeather(Climate climateType)
        {
            // Sets up the climate type which this weather manager is responsible for ticking.
            _climateType = climateType;

            // Select climate and determine humidity and temperature based on it.
            switch (_climateType)
            {
                case Climate.Polar:
                    _averageTemperatures = new List<ClimateData>(ClimateRegistry.Polar);
                    break;
                case Climate.Continental:
                    _averageTemperatures = new List<ClimateData>(ClimateRegistry.Continental);
                    break;
                case Climate.Moderate:
                    _averageTemperatures = new List<ClimateData>(ClimateRegistry.Moderate);
                    break;
                case Climate.Dry:
                    _averageTemperatures = new List<ClimateData>(ClimateRegistry.Dry);
                    break;
                case Climate.Tropical:
                    _averageTemperatures = new List<ClimateData>(ClimateRegistry.Tropical);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
        public void LoadContent(ContentManager cm, Terrain terrain, Climate climate)
        {
            switch (climate)
            {
                case Climate.Tropical:
                    texGrass = cm.Load<Texture2D>(@"textures/vegetation/grassShrub");
                    texTree = cm.Load<Texture2D>(@"textures/vegetation/tree_palm2");
                    break;
                case Climate.Polar:
                    texGrass = cm.Load<Texture2D>(@"textures/vegetation/grassTundra");
                    texTree = cm.Load<Texture2D>(@"textures/vegetation/pine-snowy");
                    break;
                case Climate.Dry:
                    texGrass = cm.Load<Texture2D>(@"textures/vegetation/grassShrub");
                    texTree = cm.Load<Texture2D>(@"textures/vegetation/tree_palm2");
                    break;
                default:
                    break;
            };

            effect = cm.Load<Effect>(@"shaders\vegetation");
            effect.Parameters["tCloudShadowMap"].SetValue(cm.Load<Texture2D>(@"textures\sky\clouds"));
            pTexture = effect.Parameters["t0"];

            Build(terrain, climate);
            declaration = new VertexDeclaration(sim.GraphicsDevice, VertexBillboard.VertexElements);
        }
Exemplo n.º 3
0
Arquivo: Well.cs Projeto: aimozs/perma
	public void UpdateLevel(Climate climate){
		switch(climate.climateType){

		case Climate.ClimateType.rainy:
			levelUI.value = levelUI.value + incrementValue;
			break;

		case Climate.ClimateType.storm:
			levelUI.value = levelUI.value + (incrementValue * 2);
			break;

		case Climate.ClimateType.sunny:

			switch(ClimateManager.Instance.previousWeather){
			case Climate.ClimateType.snowy:
				levelUI.value = levelUI.value + incrementValue;
				break;
			default:
				levelUI.value = levelUI.value - incrementValue;
				break;
			}
			break;

		default:
			break;
		}
	}
Exemplo n.º 4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ForkInRoad" /> class. Initializes a new instance of the
 ///     <see cref="T:OregonTrailDotNet.Entity.Location.Location" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="climateType">The climate Type.</param>
 /// <param name="skipChoices">The skip Choices.</param>
 public ForkInRoad(string name, Climate climateType, IEnumerable<Location> skipChoices)
     : base(name, climateType)
 {
     // Offers up a decision when traveling on the trail, there are normally one of many possible outcomes.
     if (skipChoices != null)
         this.skipChoices = new List<Location>(skipChoices);
 }
Exemplo n.º 5
0
	void AddClimateToForecast(Climate climate = null){
		
		if(climate == null)
			climate = GetRandomClimate();

		forecast.Add(climate);
		
		UIManager.Instance.AddClimate(climate);

//		Debug.Log(_initialized);

		if(_initialized)
			UpdateTemperature(forecast[0]);
	}
Exemplo n.º 6
0
        /// <summary>Initializes a new instance of the <see cref="T:OregonTrailDotNet.Entity.Location.Location" /> class.</summary>
        /// <param name="name">Display name of the location as it should be known to the player.</param>
        /// <param name="climateType">Defines the type of weather the location will have overall.</param>
        protected Location(string name, Climate climateType)
        {
            // Default warning message for the location is based on fresh water status.
            Warning = GameSimulationApp.Instance.Random.NextBool() ? LocationWarning.None : LocationWarning.BadWater;

            // Creates a new system to deal with the management of the weather for this given location.
            weather = new LocationWeather(climateType);

            // Name of the point as it should be known to the player.
            Name = name;

            // Default location status is not visited by the player or vehicle.
            Status = LocationStatus.Unreached;
        }
        public void BuildWeather(Terrain t, Climate climate)
        {
            Type weatherType = climate == Climate.Polar ? typeof(Snow) : typeof(Rain);

            if (regions[0].WeatherEffect == null || regions[0].WeatherEffect.GetType() != weatherType)
            {
                double cubicArea = Math.Pow(drawDist, 3);       // visible weather area
                int numParticles = (int)(cubicArea * 0.02f / drawDist * 150);
                bool wasActive = Active;
                Active = false;

                foreach (WeatherRegion r in regions)
                    r.BuildEffect(weatherType, numParticles, drawDist, sim);
                Active = wasActive;
            }
        }
Exemplo n.º 8
0
	void UpdateTemperature(Climate climate){
		if(temperature < climate.tempTarget)
			temperature = temperature + climate.tempMod;
		else
			temperature = temperature - climate.tempMod;
//		switch(climate.climateType){
//		case Climate.ClimateType.sunny:
//			if(temperature < 45){
//				temperature++;
//				temperature++;
//			}
//			break;
//		case Climate.ClimateType.rainy:
//			if(temperature > 10)
//				temperature--;
//			else
//				temperature++;
//			break;
//		case Climate.ClimateType.storm:
//			if(temperature > 8)
//				temperature--;
//			else
//				temperature++;
//			break;
//		case Climate.ClimateType.cloudy:
//				temperature++;
//			break;
//		case Climate.ClimateType.snowy:
//			if(temperature > 1){
//				temperature--;
//				temperature--;
//			}
//			break;
//		default:
//			break;
//		}
		GetComponentInChildren<Text>().text = temperature.ToString() + "˚C";
	}
Exemplo n.º 9
0
    private static Climate GetClimateFromString(string climateType, ClimateManager climateManager)
    {
        Climate climate = climateManager.GetClimate(0);

        switch (climateType)
        {
        case "Moderate":
            climate = climateManager.GetClimate(1);
            break;

        case "Warm":
            climate = climateManager.GetClimate(2);
            break;

        case "Tropical":
            climate = climateManager.GetClimate(3);
            break;

        case "Dry":
            climate = climateManager.GetClimate(4);
            break;
        }
        return(climate);
    }
Exemplo n.º 10
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Settlement" /> class. Initializes a new instance of the
 ///     <see cref="T:OregonTrailDotNet.Entity.Location.Location" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="climateType">The climate Type.</param>
 public Settlement(string name, Climate climateType) : base(name, climateType)
 {
 }
Exemplo n.º 11
0
 protected Mammal(Climate climateRequirements, MovementCapabilities movementCapabilities)
     : base(climateRequirements, movementCapabilities)
 {
 }
Exemplo n.º 12
0
        //---------------------------------------------------------------------

        public override void Initialize()
        {
            PlugIn.ModelCore.UI.WriteLine("Initializing {0} ...", ExtensionName);
            Timestep            = Parameters.Timestep;
            SuccessionTimeStep  = Timestep;
            sufficientLight     = Parameters.LightClassProbabilities;
            ProbEstablishAdjust = Parameters.ProbEstablishAdjustment;
            MetadataHandler.InitializeMetadata(Timestep, modelCore, SoilCarbonMapNames, SoilNitrogenMapNames, ANPPMapNames, ANEEMapNames, TotalCMapNames); //,LAIMapNames, ShadeClassMapNames);

            //Initialize climate.
            Climate.Initialize(Parameters.ClimateConfigFile, false, modelCore);
            FutureClimateBaseYear = Climate.Future_MonthlyData.Keys.Min();

            ClimateRegionData.Initialize(Parameters);
            FunctionalType.Initialize(Parameters);
            SpeciesData.Initialize(Parameters);
            Util.ReadSoilDepthMap(Parameters.SoilDepthMapName);
            Util.ReadSoilDrainMap(Parameters.SoilDrainMapName);
            Util.ReadSoilBaseFlowMap(Parameters.SoilBaseFlowMapName);
            Util.ReadSoilStormFlowMap(Parameters.SoilStormFlowMapName);
            Util.ReadFieldCapacityMap(Parameters.SoilFieldCapacityMapName);
            Util.ReadWiltingPointMap(Parameters.SoilWiltingPointMapName);
            Util.ReadPercentSandMap(Parameters.SoilPercentSandMapName);
            Util.ReadPercentClayMap(Parameters.SoilPercentClayMapName);
            Util.ReadSoilCNMaps(Parameters.InitialSOM1CSurfaceMapName,
                                Parameters.InitialSOM1NSurfaceMapName,
                                Parameters.InitialSOM1CSoilMapName,
                                Parameters.InitialSOM1NSoilMapName,
                                Parameters.InitialSOM2CMapName,
                                Parameters.InitialSOM2NMapName,
                                Parameters.InitialSOM3CMapName,
                                Parameters.InitialSOM3NMapName);
            Util.ReadDeadWoodMaps(Parameters.InitialDeadSurfaceMapName, Parameters.InitialDeadSoilMapName);

            ShadeLAI = Parameters.MaximumShadeLAI;
            OtherData.Initialize(Parameters);
            FireEffects.Initialize(Parameters);

            //  Cohorts must be created before the base class is initialized
            //  because the base class' reproduction module uses the core's
            //  SuccessionCohorts property in its Initialization method.
            Library.LeafBiomassCohorts.Cohorts.Initialize(Timestep, new CohortBiomass());

            // Initialize Reproduction routines:
            Reproduction.SufficientResources = SufficientLight;
            Reproduction.Establish           = Establish;
            Reproduction.AddNewCohort        = AddNewCohort;
            Reproduction.MaturePresent       = MaturePresent;
            base.Initialize(modelCore, Parameters.SeedAlgorithm);

            // Delegate mortality routines:
            Landis.Library.LeafBiomassCohorts.Cohort.PartialDeathEvent += CohortPartialMortality;
            Landis.Library.LeafBiomassCohorts.Cohort.DeathEvent        += CohortTotalMortality;


            InitializeSites(Parameters.InitialCommunities, Parameters.InitialCommunitiesMap, modelCore);

            if (Parameters.CalibrateMode)
            {
                Outputs.CreateCalibrateLogFile();
            }
            Establishment.InitializeLogFile();

            B_MAX = 0;
            foreach (ISpecies species in ModelCore.Species)
            {
                if (SpeciesData.Max_Biomass[species] > B_MAX)
                {
                    B_MAX = SpeciesData.Max_Biomass[species];
                }
            }

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                Main.ComputeTotalCohortCN(site, SiteVars.Cohorts[site]);
            }

            Outputs.WritePrimaryLogFile(0);
            Outputs.WriteShortPrimaryLogFile(0);
        }
Exemplo n.º 13
0
        public static Record CreateRecord(string Tag)
        {
            Record outRecord;

            switch (Tag)
            {
            case "TES4":
                outRecord = new Header();
                break;

            case "GMST":
                outRecord = new GameSetting();
                break;

            case "TXST":
                outRecord = new TextureSet();
                break;

            case "MICN":
                outRecord = new MenuIcon();
                break;

            case "GLOB":
                outRecord = new GlobalVariable();
                break;

            case "CLAS":
                outRecord = new Class();
                break;

            case "FACT":
                outRecord = new Faction();
                break;

            case "HDPT":
                outRecord = new HeadPart();
                break;

            case "HAIR":
                outRecord = new Hair();
                break;

            case "EYES":
                outRecord = new Eyes();
                break;

            case "RACE":
                outRecord = new Race();
                break;

            case "SOUN":
                outRecord = new Sound();
                break;

            case "ASPC":
                outRecord = new AcousticSpace();
                break;

            case "MGEF":
                outRecord = new MagicEffect();
                break;

            case "SCPT":
                outRecord = new Script();
                break;

            case "LTEX":
                outRecord = new LandscapeTexture();
                break;

            case "ENCH":
                outRecord = new ObjectEffect();
                break;

            case "SPEL":
                outRecord = new ActorEffect();
                break;

            case "ACTI":
                outRecord = new ESPSharp.Records.Activator();
                break;

            case "TACT":
                outRecord = new TalkingActivator();
                break;

            case "TERM":
                outRecord = new Terminal();
                break;

            case "ARMO":
                outRecord = new Armor();
                break;

            case "BOOK":
                outRecord = new Book();
                break;

            case "CONT":
                outRecord = new Container();
                break;

            case "DOOR":
                outRecord = new Door();
                break;

            case "INGR":
                outRecord = new Ingredient();
                break;

            case "LIGH":
                outRecord = new Light();
                break;

            case "MISC":
                outRecord = new MiscItem();
                break;

            case "STAT":
                outRecord = new Static();
                break;

            case "SCOL":
                outRecord = new StaticCollection();
                break;

            case "MSTT":
                outRecord = new MoveableStatic();
                break;

            case "PWAT":
                outRecord = new PlaceableWater();
                break;

            case "GRAS":
                outRecord = new Grass();
                break;

            case "TREE":
                outRecord = new Tree();
                break;

            case "FURN":
                outRecord = new Furniture();
                break;

            case "WEAP":
                outRecord = new Weapon();
                break;

            case "AMMO":
                outRecord = new Ammunition();
                break;

            case "NPC_":
                outRecord = new NonPlayerCharacter();
                break;

            case "CREA":
                outRecord = new Creature();
                break;

            case "LVLC":
                outRecord = new LeveledCreature();
                break;

            case "LVLN":
                outRecord = new LeveledNPC();
                break;

            case "KEYM":
                outRecord = new Key();
                break;

            case "ALCH":
                outRecord = new Ingestible();
                break;

            case "IDLM":
                outRecord = new IdleMarker();
                break;

            case "NOTE":
                outRecord = new Note();
                break;

            case "COBJ":
                outRecord = new ConstructibleObject();
                break;

            case "PROJ":
                outRecord = new Projectile();
                break;

            case "LVLI":
                outRecord = new LeveledItem();
                break;

            case "WTHR":
                outRecord = new Weather();
                break;

            case "CLMT":
                outRecord = new Climate();
                break;

            case "REGN":
                outRecord = new Region();
                break;

            case "NAVI":
                outRecord = new NavigationMeshInfoMap();
                break;

            case "DIAL":
                outRecord = new DialogTopic();
                break;

            case "QUST":
                outRecord = new Quest();
                break;

            case "IDLE":
                outRecord = new IdleAnimation();
                break;

            case "PACK":
                outRecord = new Package();
                break;

            case "CSTY":
                outRecord = new CombatStyle();
                break;

            case "LSCR":
                outRecord = new LoadScreen();
                break;

            case "ANIO":
                outRecord = new AnimatedObject();
                break;

            case "WATR":
                outRecord = new Water();
                break;

            case "EFSH":
                outRecord = new EffectShader();
                break;

            case "EXPL":
                outRecord = new Explosion();
                break;

            case "DEBR":
                outRecord = new Debris();
                break;

            case "IMGS":
                outRecord = new ImageSpace();
                break;

            case "IMAD":
                outRecord = new ImageSpaceAdapter();
                break;

            case "FLST":
                outRecord = new FormList();
                break;

            case "PERK":
                outRecord = new Perk();
                break;

            case "BPTD":
                outRecord = new BodyPartData();
                break;

            case "ADDN":
                outRecord = new AddonNode();
                break;

            case "AVIF":
                outRecord = new ActorValueInformation();
                break;

            case "RADS":
                outRecord = new RadiationStage();
                break;

            case "CAMS":
                outRecord = new CameraShot();
                break;

            case "CPTH":
                outRecord = new CameraPath();
                break;

            case "VTYP":
                outRecord = new VoiceType();
                break;

            case "IPCT":
                outRecord = new Impact();
                break;

            case "IPDS":
                outRecord = new ImpactDataSet();
                break;

            case "ARMA":
                outRecord = new ArmorAddon();
                break;

            case "ECZN":
                outRecord = new EncounterZone();
                break;

            case "MESG":
                outRecord = new Message();
                break;

            case "RGDL":
                outRecord = new Ragdoll();
                break;

            case "DOBJ":
                outRecord = new DefaultObjectManager();
                break;

            case "LGTM":
                outRecord = new LightingTemplate();
                break;

            case "MUSC":
                outRecord = new MusicType();
                break;

            case "IMOD":
                outRecord = new ItemMod();
                break;

            case "REPU":
                outRecord = new Reputation();
                break;

            case "RCPE":
                outRecord = new Recipe();
                break;

            case "RCCT":
                outRecord = new RecipeCategory();
                break;

            case "CHIP":
                outRecord = new CasinoChip();
                break;

            case "CSNO":
                outRecord = new Casino();
                break;

            case "LSCT":
                outRecord = new LoadScreenType();
                break;

            case "MSET":
                outRecord = new MediaSet();
                break;

            case "ALOC":
                outRecord = new MediaLocationController();
                break;

            case "CHAL":
                outRecord = new Challenge();
                break;

            case "AMEF":
                outRecord = new AmmoEffect();
                break;

            case "CCRD":
                outRecord = new CaravanCard();
                break;

            case "CMNY":
                outRecord = new CaravanMoney();
                break;

            case "CDCK":
                outRecord = new CaravanDeck();
                break;

            case "DEHY":
                outRecord = new DehydrationStage();
                break;

            case "HUNG":
                outRecord = new HungerStage();
                break;

            case "SLPD":
                outRecord = new SleepDeprivationStage();
                break;

            case "CELL":
                outRecord = new Cell();
                break;

            case "WRLD":
                outRecord = new Worldspace();
                break;

            case "LAND":
                outRecord = new GenericRecord();
                break;

            case "NAVM":
                outRecord = new NavigationMesh();
                break;

            case "INFO":
                outRecord = new DialogResponse();
                break;

            case "REFR":
                outRecord = new Reference();
                break;

            case "ACHR":
                outRecord = new PlacedNPC();
                break;

            case "ACRE":
                outRecord = new PlacedCreature();
                break;

            case "PGRE":
                outRecord = new PlacedGrenade();
                break;

            case "PMIS":
                outRecord = new PlacedMissile();
                break;

            default:
                Console.WriteLine("Encountered unknown record: " + Tag);
                outRecord = new GenericRecord();
                break;
            }

            outRecord.Tag = Tag;

            return(outRecord);
        }
Exemplo n.º 14
0
        public async Task UpdateClimate(Climate climate)
        {
            _repository.Update(climate);

            await _unit.Complete();
        }
Exemplo n.º 15
0
    public void IncreaseClimate()
    {
        if(localClimate == Climate.Wet){
            climateOver++;
        }
        if(localClimate < Climate.Wet){
            if(climateOver < 0)													{climateOver++;}
            else 																{localClimate++;}
        }

        if(localClimate < 0)													{localClimate = Climate.Desert;}
        else if(localClimate >= Climate.Wet)									{localClimate = Climate.Wet;}

        UpdateHudClimate();
    }
Exemplo n.º 16
0
 protected Animal( int id, Climate climateRequirements, MovementCapabilities movementCapabilities )
 {
     this.id = id;
     ClimateRequirements = climateRequirements;
     MovementCapabilities = movementCapabilities;
 }
Exemplo n.º 17
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="TollRoad" /> class. Initializes a new instance of the
 ///     <see cref="T:OregonTrailDotNet.Entity.Location.Location" /> class.
 /// </summary>
 /// <param name="name">Display name of the location as it should be known to the player.</param>
 /// <param name="climateType">Defines the type of weather the location will have overall.</param>
 public TollRoad(string name, Climate climateType)
     : base(name, climateType)
 {
 }
        //---------------------------------------------------------------------
        public static void Initialize(IInputParameters parameters)
        {
            PercentClay       = parameters.PercentClay;
            PercentSand       = parameters.PercentSand;
            SoilDepth         = parameters.SoilDepth;
            FieldCapacity     = parameters.FieldCapacity;
            WiltingPoint      = parameters.WiltingPoint;
            StormFlowFraction = parameters.StormFlowFraction;
            BaseFlowFraction  = parameters.BaseFlowFraction;
            Drain             = parameters.Drain;
            AtmosNslope       = parameters.AtmosNslope;
            AtmosNintercept   = parameters.AtmosNintercept;
            Latitude          = parameters.Latitude;
            DecayRateSurf     = parameters.DecayRateSurf;
            DecayRateSOM1     = parameters.DecayRateSOM1;
            DecayRateSOM2     = parameters.DecayRateSOM2;
            DecayRateSOM3     = parameters.DecayRateSOM3;
            Denitrif          = parameters.Denitrif;

            ShadeBiomass = parameters.MinRelativeBiomass;

            ActiveSiteCount    = new Ecoregions.AuxParm <int>(PlugIn.ModelCore.Ecoregions);
            LastYearUpdated    = new Ecoregions.AuxParm <int>(PlugIn.ModelCore.Ecoregions);
            AnnualWeather      = new Ecoregions.AuxParm <AnnualClimate_Monthly>(PlugIn.ModelCore.Ecoregions);
            MonthlyNDeposition = new Ecoregions.AuxParm <double[]>(PlugIn.ModelCore.Ecoregions);

            AnnualNDeposition = new Ecoregions.AuxParm <double>(PlugIn.ModelCore.Ecoregions);

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
                //PlugIn.ModelCore.UI.WriteLine("Latitude for {0} = {1}.", ecoregion.Name, parameters.Latitude[ecoregion]);

                SiteVars.SOM1surface[site].Carbon   = parameters.InitialSOM1surfC[ecoregion];
                SiteVars.SOM1surface[site].Nitrogen = parameters.InitialSOM1surfN[ecoregion];

                SiteVars.SOM1soil[site].Carbon   = parameters.InitialSOM1soilC[ecoregion];
                SiteVars.SOM1soil[site].Nitrogen = parameters.InitialSOM1soilN[ecoregion];

                SiteVars.SOM2[site].Carbon   = parameters.InitialSOM2C[ecoregion];
                SiteVars.SOM2[site].Nitrogen = parameters.InitialSOM2N[ecoregion];

                SiteVars.SOM3[site].Carbon   = parameters.InitialSOM3C[ecoregion];
                SiteVars.SOM3[site].Nitrogen = parameters.InitialSOM3N[ecoregion];

                SiteVars.MineralN[site] = parameters.InitialMineralN[ecoregion];

                ActiveSiteCount[ecoregion]++;
            }

            foreach (IEcoregion ecoregion in PlugIn.ModelCore.Ecoregions)
            {
                MonthlyNDeposition[ecoregion] = new double[12];

                //for (int i = 0; i < 12; i++)
                //    MonthlyNDeposition[ecoregion][i] = 0.0;

                if (ecoregion.Active)
                {
                    Climate.GenerateEcoregionClimateData(ecoregion, 0, Latitude[ecoregion], FieldCapacity[ecoregion], WiltingPoint[ecoregion]);
                    SetSingleAnnualClimate(ecoregion, 0, Climate.Phase.SpinUp_Climate);  // Some placeholder data to get things started.
                }
            }
        }
Exemplo n.º 19
0
    //Generates hex climate based on grid location, biome, alt, and temp
    public void GenerateClimate()
    {
        Climate climate = Climate.Arid;
        int val = 0;

        if (localBiome == Biome.Chaparral)														{ val -= Random.Range(6, 12); }
        if (localBiome == Biome.Savanna)                                                        { val -= Random.Range(8, 12); }
        if (localBiome == Biome.Tundra)                                                         { val -= Random.Range(7, 12); }
        if (localBiome == Biome.Desert)															{ val -= Random.Range(12, 20); }
        if (localBiome == Biome.Forest)															{ val += Random.Range(-4, 10); }
        if (localBiome == Biome.Taiga)															{ val += Random.Range(-4, 10); }
        if (localBiome == Biome.Rainforest)                                                     { val += Random.Range(12, 20); }
        if (localBiome == Biome.Lotic)                                                          { val += Random.Range(-2, 18); }
        if (localBiome == Biome.Wetland)                                                        { val += Random.Range(7, 18); }

        if (gridLocation.y == 0 || gridLocation.y == 4)											{ val -= Random.Range(1, 6); }
        if (NeighborContainsAlt(Altitude.Deep) || NeighborContainsAlt(Altitude.Shallow)){
            if(localAlt != Altitude.High)														{ val += Random.Range(1, 6); }
            if (NeighborContainsAlt(Altitude.High))                                             { val += Random.Range(1, 6); }
        }
        if (NeighborContainsGeo(Geography.Mountains) && !NeighborContainsGeo(Geography.SaltWater))
        {
            if (!NeighborContainsBiomeType(BiomeType.FRESHWATER))                               { val -= Random.Range(1, 6); }
        }

        if (localTemp == Temperature.Scorching)													{ val -= Random.Range(2, 6); }
        if (NeighborContainsBiome(Biome.Lotic))													{ val += Random.Range(2, 6); }
        if (localBiome == Biome.Arctic)															{ val -= Random.Range(12, 20); }

        if (localBiome == Biome.Ocean)															{ val += Random.Range(12, 20); }
        if (localBiome == Biome.Reef)                                                           { val += Random.Range(15, 20); }
        if (localBiome == Biome.Estuary)														{ val += Random.Range(12, 20); }
        if (localBiome == Biome.Shelf)													        { val += Random.Range(12, 20); }

        if(val < -22)																			{ val = -22; }
        if(val > 22)																            { val = 22; }

        climateVal = val;
        climate = (Climate)TranslateHabTraitRange(val);

        localClimate = climate;
        UpdateHudClimate();
    }
Exemplo n.º 20
0
    public void DecreaseClimate()
    {
        if(localClimate == Climate.Desert){
            climateOver--;
        }
        if(localClimate > Climate.Desert){
            if(climateOver > 0)													{climateOver--;}
            else 																{localClimate--;}
        }

        if(localClimate < 0)													{localClimate = Climate.Desert;}
        else if(localClimate >= Climate.Wet)									{localClimate = Climate.Wet;}

        UpdateHudClimate();
    }
Exemplo n.º 21
0
    private Color32 SetClimateColor(Climate val)
    {
        Color32 tempColor = iconControl.GetHexClimateColor(val);

        return tempColor;
    }
Exemplo n.º 22
0
    public void SetClimate(Climate climate)
    {
        if(climate < 0)															{climate = Climate.Desert;}
        else if(climate >= Climate.Wet)											{climate = Climate.Wet;}

        localClimate = climate;
        UpdateHudClimate();
    }
Exemplo n.º 23
0
    public void SetBaseValues()
    {
        baseBiome = localBiome;
        baseAlt = localAlt;
        baseClimate = localClimate;
        baseVeg = localVeg;
        baseTemp = localTemp;

        CorrectGeos();
    }
Exemplo n.º 24
0
 public Giraffe(Climate climateRequirements, MovementCapabilities movementCapabilities) : base(climateRequirements, movementCapabilities)
 {
 }
Exemplo n.º 25
0
//	public void UpdateFF(Parcel parcel, Plant newPlant){
//		
//		if(parcel != null) {
//			Parcel thisParcel = GetComponentInParent<Parcel>();
//
//			if(thisParcel != null){
//				float distance = Vector3.Distance(parcel.transform.position, thisParcel.transform.position);
//
//				if(0.1f < distance && distance <= 1.1f){
//					if(plant.friends.Contains(newPlant.plantName)){
//						friendStatus = FriendStatus.friend;
//						parcel.GetComponentInChildren<PlantPrefab>().friendStatus = FriendStatus.friend;
//
//					} else {
//						if(plant.foes.Contains(newPlant.plantName)){
//							StartCoroutine(PlantedFoe());
//						}
//					}
//				}
//			}
//		}
//	}

	#endregion

	#region 3.Privates

	void TestGrowth(Climate climate){
		IncreaseSize(true);
	}
Exemplo n.º 26
0
 void UpdateClimateSkybox(Climate climate)
 {
     SetSkybox(climate.climateType);
 }
Exemplo n.º 27
0
        /// <summary>
        /// Generates shortest path available with the current vehicle among given orbits
        /// </summary>
        /// <param name="orbits"></param>
        /// <param name="climate"></param>
        /// <param name="v"></param>
        /// <returns></returns>
        public static KeyValuePair <Orbit, double> GenerateShortestPathForVehicle(Orbit[] orbits, Climate climate, Vehicles v)
        {
            List <KeyValuePair <Orbit, double> > alllists = new List <KeyValuePair <Orbit, double> >();
            List <KeyValuePair <Orbit, double> > incompleteDestination = new List <KeyValuePair <Orbit, double> >();

            for (int i = 0; i < orbits.Length; i++)
            {
                var path = VehicleTimeGenerator.GetVehicleTime(orbits[i], climate, v);
                if (orbits[i].IsBreakJourney)
                {
                    incompleteDestination.Add(new KeyValuePair <Orbit, double>(orbits[i], path.Value));
                }
                else
                {
                    alllists.Add(new KeyValuePair <Orbit, double>(orbits[i], path.Value));
                }
            }
            if (incompleteDestination.Any())
            {
                alllists.Add(new KeyValuePair <Orbit, double>(incompleteDestination.Last().Key, incompleteDestination.Sum(i => i.Value)));
            }
            var minTime      = alllists.Min(a => a.Value);
            var shortestTime = alllists.First(a => a.Value == minTime);

            return(shortestTime);
        }
Exemplo n.º 28
0
	public void UpdateTemperature(Climate climate){
//		Debug.Log(climate.climateType.ToString());
		dir = UnityEngine.Random.Range(0f, 359f);
		direction.transform.rotation = Quaternion.Euler(0f, 0f, dir);
//		windZone.transform.rotation = Quaternion.Euler(0f, -dir, 0f);


		switch(climate.climateType){
		case Climate.ClimateType.storm:
			strength = UnityEngine.Random.Range(20, 50);
//			cloud.GetComponent<ParticleSystem>().Play();
//			rain.GetComponent<ParticleSystem>().Play();
//			snowFlake.GetComponent<ParticleSystem>().Stop();
			StartCoroutine(SetSun(false));
			SoundManager.PlayStorm();
			SoundManager.PlayRain();
			StartCoroutine(FlashThunder());
			break;
		case Climate.ClimateType.rainy:
			strength = UnityEngine.Random.Range(20, 50);
//			cloud.GetComponent<ParticleSystem>().Play();
//			rain.GetComponent<ParticleSystem>().Play();
//			snowFlake.GetComponent<ParticleSystem>().Stop();
			StartCoroutine(SetSun(false));
			SoundManager.PlayRain();
			break;
		case Climate.ClimateType.cloudy:
			strength = UnityEngine.Random.Range(5, 20);
//			cloud.GetComponent<ParticleSystem>().Play();
//			snowFlake.GetComponent<ParticleSystem>().Stop();
//			rain.GetComponent<ParticleSystem>().Stop();
			StartCoroutine(SetSun(true));
			SoundManager.PlayBirds();
			break;
		case Climate.ClimateType.snowy:
			strength = UnityEngine.Random.Range(5, 30);
//			snowFlake.GetComponent<ParticleSystem>().Play();
//			cloud.GetComponent<ParticleSystem>().Play();
//			rain.GetComponent<ParticleSystem>().Stop();
			StartCoroutine(SetSun(false));
			break;
		default:
			//DisableAllParticles();
			StartCoroutine(SetSun(true));
			strength = UnityEngine.Random.Range(1, 20);
			if(BtnTemperature.Instance.temperature > 22)
				SoundManager.PlayCicadas();
			else if(BtnTemperature.Instance.temperature > 10)
				SoundManager.PlayBirds();
			break;
		}
//		windZone.GetComponentInChildren<WindZone>().windMain = strength;
		StartCoroutine(SetWindStrength(strength * .9f));
		StartCoroutine(SoundManager.Instance.TransitionToVolume(strength /50f));

		UIManager.Instance.SetWindUI(strength);

	}
        private static void FillMetadata(Variable v, TimeBounds[] climatlogyIntervals, Climate.Conventions.FetchClimateBatchResponce response, string longName)
        {
            if (climatlogyIntervals != null)
                v.Metadata["cell_methods"] = "time: mean within days  time: mean over days  time: mean over years";

            string[] dataSources = response.Values.Select(r => r.Provenance).Distinct().ToArray();
            StringBuilder bld = new StringBuilder();
            bool firstDataSource = true;
            for (int i = 0; i < dataSources.Length; i++)
            {
                if (firstDataSource)
                    firstDataSource = false;
                else
                    bld.Append(", ");
                bld.Append(dataSources[i]);
            }
            string sources = bld.ToString();

            v.Metadata["long_name"] = longName;
            v.Metadata["DisplayName"] = longName;
            v.Metadata["Provenance"] = String.Format("Data sources: {0}; served by FetchClimate Service (http://fetchclimate.cloudapp.net/)", sources);
            v.Metadata["references"] = "http://fetchclimate.cloudapp.net/";
            v.Metadata["source"] = string.Format("Interpolated from {0}", sources);
            v.Metadata["institution"] = string.Format("FetchClimate service ({0})", response.ServiceVersion);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Takes the existing map of the planet and creates a climate
        /// map for the planet.
        /// </summary>
        public void GenerateClimate()
        {
            // Watt / m^2 average
            // TODO make dynamic based on star(s) and distance of planet.
            var fullSun = 1000;
            // TODO, parameterize this to make it available.
            var airZones = 6;

            // Use the Planet seed, but offset by 1 to get a different map.
            var noise    = new FastNoise(Seed + 1);
            var secNoise = new FastNoise(Seed + 2);

            // setup SolarMap for heat application. TODO, add back in later.
            #region SolarMapAndPrevailingWind

            /*
             * for (int row = 0; row < Height; ++row)
             * {
             *  // The amount that hits is relative to the height with equator
             *  // getting full and poles getting almost none.
             *  var correctedSun = (int)(Math.Sin(row / Height * Math.PI) * fullSun);
             *  // just in case, ensure only G and B is effected.
             *  correctedSun = correctedSun & 0x0000FFFF;
             *
             *  // we can also generate prevailing winds this way.
             *  // we default to 6 cells the 2 at the center point equator wise and NE to SW
             *  // TODO parameterize this.
             *  var zone = (int)(row / Height * airZones);
             *  int prevailingWind = 0;
             *
             *  // 0 NW, 2 W, 4 SW, 6 SE, 8 E, 10 NE
             *  if (zone < airZones / 2)
             *  { // north hemisphere.
             *      if (zone % 2 == 1) // if odd
             *      {// 2 hex/day SW
             *          prevailingWind = GetDirection("SW", false) + ToSpeed(2);
             *      }
             *      else
             *      {// 2 hex/day NE
             *          prevailingWind = GetDirection("NE", false) + ToSpeed(2);
             *      }
             *  }
             *  else // if above half
             *  {// Southern Hemisphere
             *      if (zone % 2 == 1)
             *      {// 2 hex/day NW
             *          prevailingWind = GetDirection("NW", false) + ToSpeed(2);
             *      }
             *      else
             *      {// 2 hex/day SE
             *          prevailingWind = GetDirection("SE", false) + ToSpeed(2);
             *      }
             *  }
             *
             *  for (int col = 0; col < Width; ++col)
             *  {
             *      // add existing albedo to corrected sun, then set.
             *      var val = SolarMap.GetHexValue(col, row) + correctedSun;
             *      SolarMap.SetPixelArgb(col, row, val);
             *      // also add prevailing winds to the green channel.
             *
             *      ClimateEx.SetHexGreen(col, row, prevailingWind);
             *  }
             * }*/
            #endregion SolarMapAndPrevailingWind

            int scale = 1;
            // TODO create real calculation for environment
            // For a shortcut, just make a selection of high and low tempurature selections.
            foreach (var pixel in Terrain)
            {
                // select random value between 0 and 255 for the tempurature
                // restricted further to 128 +/- 64
                var tempurature = (int)(255 * (1 + CylinderSample(pixel.Coord.x, pixel.Coord.y, noise) / 4));
                Climate.SetHexBlue(pixel.Coord, tempurature);

                // set humidity between 0 and 255.
                var hum = (int)(255 * (1 + CylinderSample(pixel.Coord.x, pixel.Coord.y, secNoise)) / 2);
                Climate.SetHexGreen(pixel.Coord, hum);

                // set rainfall equal to humidity for now
                Climate.SetHexRed(pixel.Coord, hum);
            }
        }
Exemplo n.º 31
0
    void SetSunLight(Climate.ClimateType currentClimate)
    {
        sunLight.intensity = .3f;

        if(GameManager.CurrentSceneName == "Montreal"){
            if(currentPeriod != DayPeriod.night){
                switch(currentClimate){
                    case Climate.ClimateType.sunny:
                        sunLight.intensity = 1f;
                        break;
                    default:
                        sunLight.intensity = .8f;
                    break;
                }
            } else {
                sunLight.intensity = .6f;
            }
        }
    }
Exemplo n.º 32
0
 protected Mammal( int id, Climate climateRequirements, MovementCapabilities movementCapabilities )
     : base(id, climateRequirements, movementCapabilities)
 {
 }
Exemplo n.º 33
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="TollRoad" /> class. Initializes a new instance of the
 ///     <see cref="T:OregonTrailDotNet.Entity.Location.Location" /> class.
 /// </summary>
 /// <param name="name">Display name of the location as it should be known to the player.</param>
 /// <param name="climateType">Defines the type of weather the location will have overall.</param>
 public TollRoad(string name, Climate climateType) : base(name, climateType)
 {
 }
Exemplo n.º 34
0
 public void SetRegion(Region newRegion)
 {
     region  = newRegion;
     Climate = region.climate;
     color   = Climate.GetColor(height);
 }
Exemplo n.º 35
0
        public async Task AddClimate(Climate climate)
        {
            await _repository.Add(climate);

            await _unit.Complete();
        }
Exemplo n.º 36
0
 public void Add(Climate climate)
 {
     context.Climates.Add(climate);
 }
Exemplo n.º 37
0
 public Agent_Climate(int sppCount, int ecoCount)
     : base(sppCount, ecoCount)
 {
     Climate.GetPDSI(1980);
 }
Exemplo n.º 38
0
 public void Remove(Climate climate)
 {
     context.Climates.Remove(climate);
 }
Exemplo n.º 39
0
        public static CurrentWeather GetCurrentWeather(City city, string apiToken)
        {
            var url = string.Format(
                "http://api.openweathermap.org/data/2.5/weather?id={0}&appid={1}&units=imperial", (int)city, apiToken
                );
            var     webreq      = WebRequest.Create(url);
            var     webResponse = webreq.GetResponse();
            var     resp        = new StreamReader(webResponse.GetResponseStream()).ReadToEnd();
            JObject json        = JObject.Parse(resp);

            var _weatherid   = json["weather"][0]["id"].Value <string>();
            var _cstimestamp = new HarvesterDateTime(); // returns now as utc double
            var _city        = json["name"].Value <string>();
            var _code        = json["cod"].Value <int>();
            var _visibility  = json["visibility"].Value <int>();

            var _weathercalculationtime = new HarvesterDateTime(
                json["dt"].Value <double>()
                );
            var _sunrise = new HarvesterDateTime(
                json["sys"]["sunrise"].Value <double>()
                );
            var _sunset = new HarvesterDateTime(
                json["sys"]["sunset"].Value <double>()
                );
            var _coords = new Coordinate(
                json["coord"]["lon"].Value <int>(),
                json["coord"]["lat"].Value <int>()
                );
            var _iconcode   = json["weather"][0]["icon"].Value <string>();
            var _conditions = new Conditions(
                json["weather"][0]["id"].Value <string>(),
                json["weather"][0]["main"].Value <string>(),
                json["weather"][0]["description"].Value <string>(),
                string.Format("https://openweathermap.org/img/{0}.png", _iconcode) // set icon url
                );
            var _climate = new Climate(
                json["main"]["temp"].Value <float>(),
                json["main"]["pressure"].Value <float>(),
                json["main"]["humidity"].Value <float>(),
                json["main"]["temp_min"].Value <float>(),
                json["main"]["temp_max"].Value <float>()
                );
            var _wind = new Wind(
                json["wind"]["speed"].Value <float>(),
                json["wind"]["deg"].Value <float>()
                );
            var _clouds = new Clouds(
                json["clouds"]["all"].Value <int>()
                );

            return(new CurrentWeather(
                       _cstimestamp,
                       _weatherid,
                       _city,
                       _code,
                       _visibility,
                       _weathercalculationtime,
                       _sunrise,
                       _sunset,
                       _coords,
                       _conditions,
                       _climate,
                       _wind,
                       _clouds
                       ));
        }
Exemplo n.º 40
0
	public void AddClimate(Climate climate){
		GameObject btnClimate = Instantiate(GameModel.Instance.btnClimatePrefab);
		btnClimate.transform.SetParent(climatePanel.transform, false);
		btnClimate.name = btnClimate.name + climatePanel.transform.childCount.ToString();
		btnClimate.GetComponent<BtnClimate>().climate = climate;
		btnClimate.GetComponent<BtnClimate>().SetClimateUI();
	}
Exemplo n.º 41
0
    protected override void RunMetabolism(BaseCombatEntity ownerEntity, float delta)
    {
        if (Interface.CallHook("OnRunPlayerMetabolism", (object)this, (object)ownerEntity, (object)delta) != null)
        {
            return;
        }
        float currentTemperature = this.owner.currentTemperature;
        float fTarget            = this.owner.currentComfort;
        float currentCraftLevel  = this.owner.currentCraftLevel;

        this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.Workbench1, (double)currentCraftLevel == 1.0);
        this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.Workbench2, (double)currentCraftLevel == 2.0);
        this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.Workbench3, (double)currentCraftLevel == 3.0);
        this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.SafeZone, this.owner.InSafeZone());
        float num1 = currentTemperature - this.DeltaWet() * 34f;
        float num2 = Mathf.Clamp(this.owner.baseProtection.amounts[18] * 1.5f, -1f, 1f);
        float num3 = Mathf.InverseLerp(20f, -50f, currentTemperature);
        float num4 = Mathf.InverseLerp(20f, 30f, currentTemperature);

        this.temperature.MoveTowards(num1 + num3 * 70f * num2 + num4 * 10f * Mathf.Abs(num2) + this.heartrate.value * 5f, delta * 5f);
        if ((double)this.temperature.value >= 40.0)
        {
            fTarget = 0.0f;
        }
        this.comfort.MoveTowards(fTarget, delta / 5f);
        float num5 = (float)(0.600000023841858 + 0.400000005960464 * (double)this.comfort.value);

        if (((double)this.calories.value <= 100.0 || (double)this.owner.healthFraction >= (double)num5 || ((double)this.radiation_poison.Fraction() >= 0.25 || (double)this.owner.SecondsSinceAttacked <= 10.0) || (this.SignificantBleeding() || (double)this.temperature.value < 10.0) ? 0 : ((double)this.hydration.value > 40.0 ? 1 : 0)) != 0)
        {
            float num6  = Mathf.InverseLerp(this.calories.min, this.calories.max, this.calories.value);
            float num7  = 5f;
            float num8  = (float)((double)num7 * (double)this.owner.MaxHealth() * 0.800000011920929 / 600.0);
            float num9  = num8 + (float)((double)num8 * (double)num6 * 0.5);
            float num10 = num9 / num7;
            float num11 = num10 + (float)((double)num10 * (double)this.comfort.value * 6.0);
            ownerEntity.Heal(num11 * delta);
            this.calories.Subtract(num9 * delta);
            this.hydration.Subtract((float)((double)num9 * (double)delta * 0.200000002980232));
        }
        this.heartrate.MoveTowards(Mathf.Clamp(0.05f + (float)((double)this.owner.estimatedSpeed2D / (double)this.owner.GetMaxSpeed() * 0.75), 0.0f, 1f), delta * 0.1f);
        float num12 = this.heartrate.Fraction() * 0.375f;

        this.calories.MoveTowards(0.0f, delta * num12);
        float num13 = 0.008333334f + Mathf.InverseLerp(40f, 60f, this.temperature.value) * 0.08333334f + this.heartrate.value * 0.06666667f;

        this.hydration.MoveTowards(0.0f, delta * num13);
        this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.NoSprint, (double)this.hydration.Fraction() <= 0.0 || (double)this.radiation_poison.value >= 100.0);
        if ((double)this.temperature.value > 40.0)
        {
            this.hydration.Add((float)((double)Mathf.InverseLerp(40f, 200f, this.temperature.value) * (double)delta * -1.0));
        }
        if ((double)this.temperature.value < 10.0)
        {
            float num6 = Mathf.InverseLerp(20f, -100f, this.temperature.value);
            this.heartrate.MoveTowards(Mathf.Lerp(0.2f, 1f, num6), delta * 2f * num6);
        }
        float num14 = this.owner.WaterFactor();

        if ((double)num14 > 0.850000023841858)
        {
            this.oxygen.MoveTowards(0.0f, delta * 0.1f);
        }
        else
        {
            this.oxygen.MoveTowards(1f, delta * 1f);
        }
        float num15 = 0.0f;
        float num16 = 0.0f;

        if (this.owner.IsOutside(this.owner.eyes.position))
        {
            num15 = Climate.GetRain(this.owner.eyes.position) * 0.6f;
            num16 = Climate.GetSnow(this.owner.eyes.position) * 0.2f;
        }
        bool flag = (double)this.owner.baseProtection.amounts[4] > 0.0;

        if (!flag)
        {
            this.wetness.value = Mathf.Max(this.wetness.value, num14);
        }
        float num17 = Mathx.Max(this.wetness.value, num15, num16);

        this.wetness.MoveTowards(Mathf.Min(num17, flag ? 0.0f : num17), delta * 0.05f);
        if ((double)num14 < (double)this.wetness.value)
        {
            this.wetness.MoveTowards(0.0f, delta * 0.2f * Mathf.InverseLerp(0.0f, 100f, currentTemperature));
        }
        this.poison.MoveTowards(0.0f, delta * 0.5555556f);
        if ((double)this.wetness.Fraction() > 0.400000005960464 && (double)this.owner.estimatedSpeed > 0.25 && (double)this.radiation_level.Fraction() == 0.0)
        {
            this.radiation_poison.Subtract((float)((double)this.radiation_poison.value * 0.200000002980232 * (double)this.wetness.Fraction() * (double)delta * 0.200000002980232));
        }
        if (ConVar.Server.radiation)
        {
            this.radiation_level.value = this.owner.radiationLevel;
            if ((double)this.radiation_level.value > 0.0)
            {
                this.radiation_poison.Add(this.radiation_level.value * delta);
            }
        }
        if ((double)this.pending_health.value <= 0.0)
        {
            return;
        }
        float num18 = Mathf.Min(1f * delta, this.pending_health.value);

        ownerEntity.Heal(num18);
        if ((double)ownerEntity.healthFraction == 1.0)
        {
            this.pending_health.value = 0.0f;
        }
        else
        {
            this.pending_health.Subtract(num18);
        }
    }
Exemplo n.º 42
0
	void AdjustHunger(Climate climate){
		healthSlider.value += -.01f;
		if(healthSlider.value < .02f){
			healthSlider.value = 1f;
			UnityAdsButton.Instance.DisplayAd();
		}
	}
Exemplo n.º 43
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="RiverCrossing" /> class. Initializes a new instance of the
 ///     <see cref="T:OregonTrailDotNet.Entity.Location.Location" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="climateType">The climate Type.</param>
 /// <param name="riverOption">The river Option.</param>
 public RiverCrossing(string name, Climate climateType, RiverOption riverOption = RiverOption.FloatAndFord)
     : base(name, climateType)
 {
     // Set the river option into the location itself.
     RiverCrossOption = riverOption;
 }
Exemplo n.º 44
0
 void UpdateClimateSkybox(Climate climate)
 {
     SetSkybox(climate.climateType);
 }
Exemplo n.º 45
0
        static void Main(string[] args)
        {
            Console.WriteLine("Choose the problem: \n" +
                              "1.Problem1 \n" +
                              "2.Problem2: Mission Impossible");
            int problem = Convert.ToInt32(Console.ReadLine());

            Console.Write("Enter the weather type:" + "\n" +
                          "1.Sunny" + "\n" +
                          "2.Windy" + "\n" +
                          "3.Rainy" + "\n");

            Climate c = (Climate)Convert.ToInt32(Console.ReadLine());
            Random  r = new Random();

            Orbit orbit1 = new Orbit()
            {
                Craters      = 20,
                Distance     = 18,
                TrafficSpeed = GetTrafficSpeed(r),
                OrbitName    = "Orbit1",
                Destination  = "Hallithiran"
            };
            Orbit orbit2 = new Orbit()
            {
                Craters      = 10,
                Distance     = 20,
                TrafficSpeed = GetTrafficSpeed(r),
                OrbitName    = "Orbit2",
                Destination  = "Hallithiran"
            };
            Orbit orbit3 = new Orbit()
            {
                Craters      = 15,
                Distance     = 30,
                TrafficSpeed = GetTrafficSpeed(r),
                OrbitName    = "Orbit3",
                Destination  = "RKPuram"
            };
            Orbit orbit4 = new Orbit()
            {
                Craters      = 18,
                Distance     = 15,
                TrafficSpeed = GetTrafficSpeed(r),
                OrbitName    = "Orbit4",
                Destination  = "Hallithiran"
            };

            Orbit[]             orbitProblem1 = new Orbit[] { orbit1, orbit2 };
            Orbit[]             orbitProblem2 = new Orbit[] { orbit1, orbit2, orbit3, orbit4 };
            List <CorrectOrbit> orbits        = new List <CorrectOrbit>();

            if (problem == 1)
            {
                orbits = OrbitGenerator.GenerateCorrectRoute(orbitProblem1, c, true);
            }
            else
            {
                orbits = OrbitGenerator.GenerateCorrectRoute(orbitProblem2, c, false);

                orbits.First().Destination = "Hallithiran";
                orbits[1].Destination = "RKPuram";
            }

            foreach (var item in orbits)
            {
                Console.WriteLine("The Shortest time taken to " + item.Destination + " is " + (item.TimeTaken * 60) +
                                  " minutes via " + item.Orbit.ToString() + " using " + item.TypeofVehicle.ToString()
                                  + " with the current traffic being " + orbitProblem2.First(o => o.OrbitName == item.Orbit).TrafficSpeed);
            }
            Console.Read();
        }
Exemplo n.º 46
0
 protected Animal(Climate climateRequirements, MovementCapabilities movementCapabilities)
 {
     id = nextId++;
     ClimateRequirements  = climateRequirements;
     MovementCapabilities = movementCapabilities;
 }
Exemplo n.º 47
0
 protected Reptile(Climate climateRequirements, MovementCapabilities movementCapabilities)
     : base(climateRequirements, movementCapabilities)
 {
 }
        public void LoadContent(ContentManager cm, Climate climate)
        {
            texCursor = cm.Load <Texture2D>(@"textures\gui\target");
            effect    = cm.Load <Effect>(@"shaders\terrain");
            effect.Parameters["matWorld"].SetValue(Matrix.Identity);
            effect.Parameters["tCursor"].SetValue(texCursor);
            effect.Parameters["tCloudShadowMap"].SetValue(cm.Load <Texture2D>(@"textures\sky\clouds"));
            seafloorTechnique = effect.Techniques["Seafloor"];
            terrainTechnique  = effect.Techniques["MultiTextured"];

            switch (climate)
            {
            case Climate.Tropical:
                effect.Parameters["tShore"].SetValue(cm.Load <Texture2D>(@"textures\terrain\sand"));
                effect.Parameters["tShoreNormals"].SetValue(cm.Load <Texture2D>(@"textures\terrain\sand_normals"));
                effect.Parameters["tPlains1"].SetValue(cm.Load <Texture2D>(@"textures\terrain\grass"));
                effect.Parameters["tPlains1Normals"].SetValue(cm.Load <Texture2D>(@"textures\terrain\grass_normals"));
                effect.Parameters["tPlains2"].SetValue(cm.Load <Texture2D>(@"textures\terrain\grass2"));
                effect.Parameters["tPlains2Normals"].SetValue(cm.Load <Texture2D>(@"textures\terrain\grass_normals"));
                effect.Parameters["tRock"].SetValue(cm.Load <Texture2D>(@"textures\terrain\rock"));
                effect.Parameters["tRockNormals"].SetValue(cm.Load <Texture2D>(@"textures\terrain\rock_normals"));
                surfaceReflectivity = new Vector4(0, 0, 0, 0.35f);
                break;

            case Climate.Dry:
                Texture2D sand        = cm.Load <Texture2D>(@"textures\terrain\sand");
                Texture2D sandNormals = cm.Load <Texture2D>(@"textures\terrain\sand_normals");
                effect.Parameters["tShore"].SetValue(sand);
                effect.Parameters["tShoreNormals"].SetValue(sandNormals);
                effect.Parameters["tPlains1"].SetValue(sand);
                effect.Parameters["tPlains1Normals"].SetValue(sandNormals);
                effect.Parameters["tPlains2"].SetValue(cm.Load <Texture2D>(@"textures\terrain\sand2"));
                effect.Parameters["tPlains2Normals"].SetValue(sandNormals);
                effect.Parameters["tRock"].SetValue(cm.Load <Texture2D>(@"textures\terrain\rock"));
                effect.Parameters["tRockNormals"].SetValue(cm.Load <Texture2D>(@"textures\terrain\rock_normals"));
                surfaceReflectivity = new Vector4(0, 0, 0, 0.35f);
                break;

            case Climate.Polar:
                effect.Parameters["tShore"].SetValue(cm.Load <Texture2D>(@"textures\terrain\tundra2"));
                effect.Parameters["tShoreNormals"].SetValue(cm.Load <Texture2D>(@"textures\terrain\tundra2_normals"));
                effect.Parameters["tPlains1"].SetValue(cm.Load <Texture2D>(@"textures\terrain\tundra"));
                effect.Parameters["tPlains1Normals"].SetValue(cm.Load <Texture2D>(@"textures\terrain\tundra_normals"));
                effect.Parameters["tPlains2"].SetValue(cm.Load <Texture2D>(@"textures\terrain\snow"));
                effect.Parameters["tPlains2Normals"].SetValue(cm.Load <Texture2D>(@"textures\terrain\snow_normals"));
                effect.Parameters["tRock"].SetValue(cm.Load <Texture2D>(@"textures\terrain\rocksnow"));
                effect.Parameters["tRockNormals"].SetValue(cm.Load <Texture2D>(@"textures\terrain\rock_normals"));
                surfaceReflectivity = new Vector4(0, 0.2f, 0.75f, 0.35f);
                break;

            case Climate.Continental:
                break;

            case Climate.Boreal:
                break;

            default:
                break;
            }

            effect.Parameters["vSurfaceReflectivity"].SetValue(surfaceReflectivity);
        }
Exemplo n.º 49
0
        /// <summary>
        /// Point-to-point mode functionality, with variability specified with time/location/situation (TLS)
        /// </summary>
        /// <param name="h_tx__meter">Structural height of the TX, in meters</param>
        /// <param name="h_rx__meter">Structural height of the RX, in meters</param>
        /// <param name="pfl">Terrain data, in PFL format</param>
        /// <param name="climate">Radio climate</param>
        /// <param name="N_0">Refractivity, in N-Units</param>
        /// <param name="f__mhz">Frequency, in MHz</param>
        /// <param name="pol">Polarization</param>
        /// <param name="epsilon">Relative permittivity</param>
        /// <param name="sigma">Conductivity</param>
        /// <param name="mdvar">Mode of variability</param>
        /// <param name="time">Time percentage</param>
        /// <param name="location">Location percentage</param>
        /// <param name="situation">Situation percentage</param>
        /// <param name="A__db">Basic transmission loss, in dB</param>
        /// <param name="warnings">Warning flags</param>
        /// <returns>Error code</returns>
        public static int ITM_P2P_TLS(double h_tx__meter, double h_rx__meter, double[] pfl, Climate climate, double N_0, double f__mhz,
                                      Polarization pol, double epsilon, double sigma, int mdvar, double time, double location, double situation,
                                      out double A__db, out Warnings warnings)
        {
            int rtn = ITM_P2P_TLS(h_tx__meter, h_rx__meter, pfl, (int)climate, N_0, f__mhz, (int)pol, epsilon, sigma, mdvar, time,
                                  location, situation, out A__db, out long warns);

            warnings = (Warnings)warns;
            return(rtn);
        }
Exemplo n.º 50
0
 protected Animal( Climate climateRequirements, MovementCapabilities movementCapabilities )
 {
     id = nextId++;
     ClimateRequirements = climateRequirements;
     MovementCapabilities = movementCapabilities;
 }
Exemplo n.º 51
0
 protected Animal(int id, Climate climateRequirements, MovementCapabilities movementCapabilities)
 {
     this.id              = id;
     ClimateRequirements  = climateRequirements;
     MovementCapabilities = movementCapabilities;
 }
Exemplo n.º 52
0
        /// <summary>
        /// Point-to-point mode functionality, with variability specified with confidence/reliability (CR)
        /// </summary>
        /// <param name="h_tx__meter">Structural height of the TX, in meters</param>
        /// <param name="h_rx__meter">Structural height of the RX, in meters</param>
        /// <param name="pfl">Terrain data, in PFL format</param>
        /// <param name="climate">Radio climate</param>
        /// <param name="N_0">Refractivity, in N-Units</param>
        /// <param name="f__mhz">Frequency, in MHz</param>
        /// <param name="pol">Polarization</param>
        /// <param name="epsilon">Relative permittivity</param>
        /// <param name="sigma">Conductivity</param>
        /// <param name="mdvar">Mode of variability</param>
        /// <param name="confidence">Confidence percentage</param>
        /// <param name="reliability">Reliability percentage</param>
        /// <param name="A__db">Basic transmission loss, in dB</param>
        /// <param name="warnings">Warning flags</param>
        /// <param name="interValues">Struct of intermediate values</param>
        /// <returns>Error code</returns>
        public static int ITM_P2P_CR_Ex(double h_tx__meter, double h_rx__meter, double[] pfl, Climate climate, double N_0,
                                        double f__mhz, Polarization pol, double epsilon, double sigma, int mdvar, double confidence, double reliability,
                                        out double A__db, out Warnings warnings, out IntermediateValues interValues)
        {
            int rtn = ITM_P2P_CR_Ex(h_tx__meter, h_rx__meter, pfl, (int)climate, N_0, f__mhz, (int)pol, epsilon, sigma, mdvar,
                                    confidence, reliability, out A__db, out long warns, out interValues);

            warnings = (Warnings)warns;
            return(rtn);
        }
Exemplo n.º 53
0
 void WorldSetup()
 {
     worldO2 = Oxygen.Moderate;
     worldClimate = Climate.Temperate;
     worldTemp = Temperature.Temperate;
 }
Exemplo n.º 54
0
        /// <summary>
        /// Area mode functionality
        /// </summary>
        /// <param name="h_tx__meter">Structural height of the TX, in meters</param>
        /// <param name="h_rx__meter">Structural height of the RX, in meters</param>
        /// <param name="tx_site_criteria">Siting criteria of the TX</param>
        /// <param name="rx_site_criteria">Siting criteria of the RX</param>
        /// <param name="d__km">Path distance, in km</param>
        /// <param name="delta_h__meter">Terrain irregularity parameter</param>
        /// <param name="climate">Radio climate</param>
        /// <param name="N_0">Refractivity, in N-Units</param>
        /// <param name="f__mhz">Frequency, in MHz</param>
        /// <param name="pol">Polarization</param>
        /// <param name="epsilon">Relative permittivity</param>
        /// <param name="sigma">Conductivity</param>
        /// <param name="mdvar">Mode of variability</param>
        /// <param name="time">Time percentage</param>
        /// <param name="location">Location percentage</param>
        /// <param name="situation">Situation percentage</param>
        /// <param name="A__db">Basic transmission loss, in dB</param>
        /// <param name="warnings">Warning flags</param>
        /// <returns>Error code</returns>
        public static int ITM_AREA_TLS(double h_tx__meter, double h_rx__meter, SitingCriteria tx_site_criteria,
                                       SitingCriteria rx_site_criteria, double d__km, double delta_h__meter, Climate climate, double N_0,
                                       double f__mhz, Polarization pol, double epsilon, double sigma, int mdvar, double time, double location,
                                       double situation, out double A__db, out Warnings warnings)
        {
            int rtn = ITM_AREA_TLS(h_tx__meter, h_rx__meter, (int)tx_site_criteria, (int)rx_site_criteria, d__km, delta_h__meter,
                                   (int)climate, N_0, f__mhz, (int)pol, epsilon, sigma, mdvar, time, location, situation, out A__db, out long warns);

            warnings = (Warnings)warns;
            return(rtn);
        }
Exemplo n.º 55
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="RiverCrossing" /> class. Initializes a new instance of the
 ///     <see cref="T:OregonTrailDotNet.Entity.Location.Location" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="climateType">The climate Type.</param>
 /// <param name="riverOption">The river Option.</param>
 public RiverCrossing(string name, Climate climateType, RiverOption riverOption = RiverOption.FloatAndFord)
     : base(name, climateType)
 {
     // Set the river option into the location itself.
     RiverCrossOption = riverOption;
 }
Exemplo n.º 56
0
        /// <summary>
        /// Area mode functionality
        /// </summary>
        /// <param name="h_tx__meter">Structural height of the TX, in meters</param>
        /// <param name="h_rx__meter">Structural height of the RX, in meters</param>
        /// <param name="tx_site_criteria">Siting criteria of the TX</param>
        /// <param name="rx_site_criteria">Siting criteria of the RX</param>
        /// <param name="d__km">Path distance, in km</param>
        /// <param name="delta_h__meter">Terrain irregularity parameter</param>
        /// <param name="climate">Radio climate</param>
        /// <param name="N_0">Refractivity, in N-Units</param>
        /// <param name="f__mhz">Frequency, in MHz</param>
        /// <param name="pol">Polarization</param>
        /// <param name="epsilon">Relative permittivity</param>
        /// <param name="sigma">Conductivity</param>
        /// <param name="mdvar">Mode of variability</param>
        /// <param name="confidence">Confidence percentage</param>
        /// <param name="reliability">Reliability percentage</param>
        /// <param name="A__db">Basic transmission loss, in dB</param>
        /// <param name="warnings">Warning flags</param>
        /// <param name="interValues">Struct of intermediate values</param>
        /// <returns>Error code</returns>
        public static int ITM_AREA_CR_Ex(double h_tx__meter, double h_rx__meter, SitingCriteria tx_site_criteria,
                                         SitingCriteria rx_site_criteria, double d__km, double delta_h__meter, Climate climate, double N_0,
                                         double f__mhz, Polarization pol, double epsilon, double sigma, int mdvar, double confidence, double reliability,
                                         out double A__db, out Warnings warnings, out IntermediateValues interValues)
        {
            int rtn = ITM_AREA_CR_Ex(h_tx__meter, h_rx__meter, (int)tx_site_criteria, (int)rx_site_criteria, d__km,
                                     delta_h__meter, (int)climate, N_0, f__mhz, (int)pol, epsilon, sigma, mdvar, confidence, reliability,
                                     out A__db, out long warns, out interValues);

            warnings = (Warnings)warns;
            return(rtn);
        }
Exemplo n.º 57
0
    public IEnumerator InitializeCombat(Fighter[] teamA, Fighter[] teamB, List <GlobalBuffs.GlobalHotDot> globalHotDots, Climate climate)
    {
        StopAllCoroutines();

        this.teamA = RelicManager.instance.CombatStart(teamA);

        this.teamB     = teamB;
        ended          = false;
        currentFighter = null;
        this.climate   = climate;

        if (climate != null)
        {
            climate.Setup();
        }

        //combatUI.InitializeCombat(teamA, teamB);
        combat3Dcontroller.Setup(this.teamA, teamB);
        combat3DUI.InitializeUI(this.teamA, teamB);

        foreach (Fighter f in GetAllFighters())
        {
            f.OnDeath.AddListener(CheckDeath);
        }

        if (ExperienceManager.instance != null)
        {
            ExperienceManager.instance.CalculatePotentialExperience(this);
        }

        StoreAllFightersInSpeedList();
        SortSpeedList();
        CombatSpeedElementManager.instance.SetupPanel(speedList);


        // ------- Events ------ //
        EventManager.CombatEvent eventParam = new EventManager.CombatEvent();
        EventManager.TriggerEvent(EventManager.combatEvents.combatStart, eventParam);

        // --------------------- //

        foreach (GlobalBuffs.GlobalHotDot globalHotDot in globalHotDots)
        {
            if (globalHotDot.combatsLeft > 0)
            {
                if (globalHotDot.affectsAllies)
                {
                    for (int i = 0; i < this.teamA.Length; i++)
                    {
                        var hotdot = new HotDot.HotDotInstance(globalHotDot.hotdot, globalHotDot.hotdot.hotdotID + this.teamA[i].fighterName, null);
                        yield return(StartCoroutine(this.teamA[i].GetDotManager().AddNewHotDot(hotdot)));
                    }
                }
                if (globalHotDot.affectsEnemies)
                {
                    for (int i = 0; i < teamB.Length; i++)
                    {
                        var hotdot = new HotDot.HotDotInstance(globalHotDot.hotdot, globalHotDot.hotdot.hotdotID + teamB[i].fighterName, null);
                        yield return(StartCoroutine(teamB[i].GetDotManager().AddNewHotDot(hotdot)));
                    }
                }
            }
        }

        if (RelicManager.instance != null)
        {
            RelicManager.instance.InitializeAll();
        }

        StartCoroutine(NextTurn());
    }
Exemplo n.º 58
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Landmark" /> class. Initializes a new instance of the
 ///     <see cref="T:OregonTrailDotNet.Entity.Location.Location" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="climateType">The climate Type.</param>
 public Landmark(string name, Climate climateType)
     : base(name, climateType)
 {
 }
 private static void FillProvenanceMetadata(Variable v, Climate.Conventions.FetchClimateBatchResponce response, string longName)
 {
     string[] dataSources = response.Values.Select(r => r.Provenance).Distinct().ToArray();
     StringBuilder bld = new StringBuilder();
     bool firstDataSource = true;
     for (int i = 0; i < dataSources.Length; i++)
     {
         if (firstDataSource)
             firstDataSource = false;
         else
             bld.Append(", ");
         bld.Append(dataSources[i]);
     }
     string sources = bld.ToString();
     longName = String.Format("Provenance ({0})", longName);
     v.Metadata["long_name"] = longName;
     v.Metadata["DisplayName"] = longName;
     v.Metadata["Provenance"] = String.Format("Data sources: {0}; served by FetchClimate Service (http://fetchclimate.cloudapp.net/)", sources);
     v.Metadata["references"] = "http://fetchclimate.cloudapp.net/";
     v.Metadata["source"] = "FetchClimate service";
     v.Metadata["institution"] = string.Format("FetchClimate service ({0})", response.ServiceVersion);
 }
Exemplo n.º 60
0
 public void SetSkybox(Climate.ClimateType climateType)
 {
     //		if(currentPeriod == DayPeriod.day){
     //			switch(climateType){
     //			case Climate.ClimateType.cloudy:
     //				RenderSettings.skybox = cloudy;
     //				break;
     //			case Climate.ClimateType.rainy:
     //				RenderSettings.skybox = rainy;
     //				break;
     //			case Climate.ClimateType.storm:
     //				RenderSettings.skybox = stormy;
     //				break;
     //			case Climate.ClimateType.sunny:
     //				RenderSettings.skybox = sunny;
     //				break;
     //			case Climate.ClimateType.snowy:
     //				RenderSettings.skybox = cloudy;
     //				break;
     //			default:
     //				break;
     //			}
     //		}
 }