Example #1
0
	// Use this for initialization
	void Start () {
		mainLight = GetComponent<Light>();
		weatherController = GetComponent<WeatherControl>();
        skyMat = RenderSettings.skybox;

		//skySpeed = 0.01;
	}
Example #2
0
        static void Main(string[] args)
        {
            WeatherControl provider = new WeatherControl();
            Window1        window1  = new Window1();

            provider.EventNewWeatherConditions += window1.OnNext;
            Window2 window2 = new Window2();

            window2.Subscribe(provider);
            Window3 window3 = new Window3();

            window3.Subscribe(provider);

            do
            {
                provider.GetWeather("Korosten");
            } while (((ConsoleKeyInfo)Console.ReadKey()).Key != ConsoleKey.Enter);
            window3.Unsubscribe(provider);
            do
            {
                provider.GetWeather("Kyiv");
            } while (((ConsoleKeyInfo)Console.ReadKey()).Key != ConsoleKey.Enter);

            // var client = new OpenWeatherAPI.OpenWeatherAPI("d9a69d574ef7c5bdccdc52b2b0b13458");
            // var results = client.Query("Kyiv");
            // Console.WriteLine($"The temperature in Kyiv is {results.Main.Temperature.CelsiusCurrent}C. There is {results.Wind.SpeedMetersPerSecond} f/s wind in the {results.Wind.Direction} direction.");

            Console.ReadLine();
        }
Example #3
0
    public IEnumerator WeatherFinder()
    {
        print("Preparing...");
        GameObject manager = GameObject.Find("WeatherManager");

        myWeather = manager.GetComponent <WeatherManager>();
        weatherC  = manager.GetComponent <WeatherControl>();


        //myWeather.cityName = CitySearch;

        //myWeather.GetJsonData();
        yield return(StartCoroutine(GetCityData()));

        weatherC.spawnWeatherEmote(myWeather.weather);

        GameObject.Find("WeatherText(TMP)").GetComponent <TextMeshPro>().text = myWeather.weather;
        GameObject.Find("CityText(TMP)").GetComponent <TextMeshPro>().text    = myWeather.location;
        print(myWeather.location);
        print(myWeather.weather);
        print(myWeather.geoLat);
        print(myWeather.geoLon);
        print(myWeather.geoLocation);

        print("WEATHER FOUND!");
    }
Example #4
0
        public PrecipitationViewer(Viewer viewer, WeatherControl weatherControl)
        {
            Viewer         = viewer;
            WeatherControl = weatherControl;
            Weather        = viewer.Simulator.Weather;

            Material      = viewer.MaterialManager.Load("Precipitation");
            Pricipitation = new PrecipitationPrimitive(Viewer.RenderProcess.GraphicsDevice);

            Wind = new Vector3(0, 0, 0);
            Reset();
        }
Example #5
0
        protected static void ApplySeason(Season season)
        {
            ApplySpawnerSuppression(season == Season.Winter);

            //switch (season)
            //{
            //case Season.Spring:
            //case Season.Summer:
            //case Season.Winter:
            if (season == Season.Spring || season == Season.Summer || (season == Season.Winter && Tempest.Settings.mRemoveLeavesInWinter))
            {
                WeatherControl.SetWorldLeavesAmount(0f);
                Common.FunctionTask.Perform(new Sims3.Gameplay.Function(RemoveLeaves));
            }
        }
Example #6
0
 private void cbWeatherControl_CheckedChanged(object sender, EventArgs e)
 {
     if (cbWeatherControl.Checked)
     {
         WeatherControl weatherControl = new WeatherControl();
         weatherControl.Dock = DockStyle.Fill;
         pnForms.Controls.Clear();
         pnForms.Controls.Add(weatherControl);
         cbWeatherControl.Enabled             = false;
         cbDataJoinControl.Enabled            = true;
         cbDataJoinControl.Checked            = false;
         cbTurbinsCsvGeneratorControl.Enabled = true;
         cbTurbinsCsvGeneratorControl.Checked = false;
     }
 }
Example #7
0
 //[CallOnThread("Render")]
 public World(Viewer viewer, double gameTime)
 {
     Viewer = viewer;
     PerformanceInitialViewingDistance = Viewer.Settings.ViewingDistance;
     PerformanceInitialLODBias         = Viewer.Settings.LODBias;
     // Control stuff first.
     // check if weather file is defined
     if (string.IsNullOrEmpty(viewer.Simulator.UserWeatherFile))
     {
         WeatherControl = new WeatherControl(viewer);
     }
     else
     {
         WeatherControl = new AutomaticWeather(viewer, viewer.Simulator.UserWeatherFile, gameTime);
     }
     // Then drawers.
     if (viewer.Settings.UseMSTSEnv)
     {
         MSTSSky = new MSTSSkyDrawer(viewer);
     }
     else
     {
         Sky = new SkyViewer(viewer);
     }
     Precipitation = new PrecipitationViewer(viewer, WeatherControl);
     Terrain       = new TerrainViewer(viewer);
     Scenery       = new SceneryDrawer(viewer);
     Trains        = new TrainDrawer(viewer);
     RoadCars      = new RoadCarViewer(viewer);
     // Then sound.
     if (viewer.Settings.SoundDetailLevel > 0)
     {
         // Keep it silent while loading.
         ALSoundSource.MuteAll();
         // TODO: This looks kinda evil; do something about it.
         GameSounds = new SoundSource(viewer, SoundEventSource.InGame, viewer.Simulator.RoutePath + "\\Sound\\ingame.sms", true);
         Viewer.SoundProcess.AddSoundSources(GameSounds.SMSFolder + "\\" + GameSounds.SMSFileName, new List <SoundSourceBase>()
         {
             GameSounds
         });
         Sounds = new WorldSounds(viewer);
     }
 }
Example #8
0
        private void Init()
        {
            Settings settings = SettingsHelper.GetSettings();

            weather = new Weather(
                ApplicationConstants.WEATHER_API_KEY,
                ApplicationConstants.DEFAULT_COUNTRY,
                ApplicationConstants.DEFAULT_CITY,
                UnitsType.METRIC);

            WeatherControl = new WeatherControl(weather, settings.WeatherRefreshRate);
            this.Controls.Add(WeatherControl);
            pnlTop.BackColor = WeatherControl.BackColor;
            this.Size        = new Size(WeatherControl.Width, WeatherControl.Height);

            SetLocation(settings.WeatherStartScreen, settings.WeatherLocation);

            this.StartPosition = FormStartPosition.Manual;
            this.TopMost       = settings.IsWeatherAlwaysTop;
        }
Example #9
0
        public event Action <InteractionMode> onModeChanged; // delegate invoked from UIPanel for changing the InteractionMode

        private void Awake()
        {
            controlsConfig    = GetComponent <ControlsConfig>();
            vegetationFactory = FindObjectOfType <VegetationFactory>();
            weatherControl    = FindObjectOfType <WeatherControl>();
        }
Example #10
0
 public void Unsubscribe(WeatherControl weatherControl)
 {
     weatherControl.EventNewWeatherConditions -= this.OnNext;
 }
 private void Awake()
 {
     weatherControl = FindObjectOfType <WeatherControl>();
     weatherControl.onSimulationStateChanged += ChangeState;
 }
Example #12
0
 private void Awake()
 {
     weatherControl    = FindObjectOfType <WeatherControl>();
     vegetationFactory = FindObjectOfType <VegetationFactory>();
 }
Example #13
0
    void Awake()
    {
        instance = this;

        try
        {
            NetworkTransport.Init();

            clientConfig    = new ConnectionConfig();
            clientChannelId = clientConfig.AddChannel(QosType.StateUpdate); // QosType.UnreliableFragmented

            // add client host
            clientTopology = new HostTopology(clientConfig, 1);
            clientHostId   = NetworkTransport.AddHost(clientTopology, clientPort);

            if (clientHostId < 0)
            {
                throw new UnityException("AddHost failed for client port " + clientPort);
            }

            if (broadcastPort > 0)
            {
                // add broadcast host
                bcastHostId = NetworkTransport.AddHost(clientTopology, broadcastPort);

                if (bcastHostId < 0)
                {
                    throw new UnityException("AddHost failed for broadcast port " + broadcastPort);
                }

                // start broadcast discovery
                byte error = 0;
                NetworkTransport.SetBroadcastCredentials(bcastHostId, 8888, 1, 0, out error);
            }

            // construct keep-alive data
            keepAliveData[0] = "ka,kb,km,kh"; // index 0
            sendKeepAlive[0] = true;

            //			faceManager = GetComponent<FacetrackingManager>();
            //			if(faceManager != null && faceManager.isActiveAndEnabled)
            //			{
            //				keepAliveData[1] = "ka,fp,";  // index 1
            //				sendKeepAlive[1] = true;
            //
            //				if(faceManager.getFaceModelData)
            //				{
            //					keepAliveData[2] = "ka,fv,";  // index 2
            //					sendKeepAlive[2] = true;
            //
            //					if(faceManager.texturedModelMesh == FacetrackingManager.TextureType.FaceRectangle)
            //					{
            //						keepAliveData[2] += "fu,";  // request uvs
            //					}
            //
            //					keepAliveData[3] = "ka,ft,";  // index 3
            //					sendKeepAlive[3] = true;
            //				}
            //			}

            keepAliveCount = keepAliveData.Length;
        }
        catch (System.Exception ex)
        {
            Debug.LogError(ex.Message + "\n" + ex.StackTrace);

            if (statusText)
            {
                statusText.text = ex.Message;
            }
        }
    }