static void Draw_Weather(EnvironmentSimulator sim)
        {
            Weather currWeather = sim.Weather;

            Weather[] list = (Weather[])Enum.GetValues(typeof(Weather));
            int       half = list.Length / 2;

            GUILayout.Label("Weather", headerStyle);

            GUILayout.BeginHorizontal();
            for (int i = 0; i < list.Length; i++)
            {
                Weather weather = list[i];

                if (i % half == 0)
                {
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                }

                if (GUILayout.Button(
                        $"{weather.ToString()}",
                        currWeather == weather ?
                        selectedButtonStyle :
                        GUI.skin.button,
                        GUILayout.Width(80f)
                        ))
                {
                    sim.RefreshWeather(weather);
                    break;
                }
            }
            GUILayout.EndHorizontal();
        }
예제 #2
0
 public void SetSimulation(EnvironmentSimulator sim)
 {
     this.Time             = (Environment.SerializableDateTime)sim.Now;
     this.Weather          = sim.Weather;
     this.Temperature      = sim.Temperature;
     this.TemperatureValue = sim.TemperatureValue;
 }
예제 #3
0
 /// <summary>
 /// Get the current game EnvironmentSimulator (Cycle in KK) object, if it exists.
 /// </summary>
 protected static EnvironmentSimulator GetCycle()
 {
     if (_environmentSimulator == null)
     {
         _environmentSimulator = FindObjectOfType <EnvironmentSimulator>();
     }
     return(_environmentSimulator);
 }
예제 #4
0
 public override void OnWeatherChanged(EnvironmentSimulator _simulator)
 {
     base.OnWeatherChanged(_simulator);
     if (!this.DepopPossible || this.weather != Weather.Rain && this.weather != Weather.Storm)
     {
         return;
     }
     this.TryToDepopState();
 }
예제 #5
0
        private void OnUpdate()
        {
            if (!Singleton <Manager.Map> .IsInstance() || Object.op_Equality((Object)Singleton <Manager.Map> .Instance.Simulator, (Object)null))
            {
                return;
            }
            EnvironmentSimulator simulator = Singleton <Manager.Map> .Instance.Simulator;
            DateTime             now       = simulator.Now;

            if (!this.EqualsTime(now))
            {
                this._hour   = now.Hour;
                this._minute = now.Minute;
                this._timeLabel.set_text(string.Format("{0:00}:{1:00}", (object)this._hour, (object)this._minute));
            }
            int temperatureValue = (int)simulator.TemperatureValue;

            if (this._temperature != temperatureValue)
            {
                this._temperature = temperatureValue;
                this._temperatureLabel.set_text(string.Format("{0:0}℃", (object)this._temperature));
            }
            if (this._weather == simulator.Weather && this._weatherIconID != -1)
            {
                return;
            }
            this._weather = simulator.Weather;
            switch (this._weather)
            {
            case Weather.Clear:
            case Weather.Cloud1:
            case Weather.Cloud2:
                this._weatherIconID = 0;
                break;

            case Weather.Cloud3:
            case Weather.Cloud4:
                this._weatherIconID = 1;
                break;

            case Weather.Fog:
                this._weatherIconID = 4;
                break;

            case Weather.Rain:
                this._weatherIconID = 2;
                break;

            case Weather.Storm:
                this._weatherIconID = 3;
                break;
            }
            this._weatherImage.set_sprite((Sprite)null);
            this._weatherImage.set_sprite(Singleton <Resources> .Instance.itemIconTables.WeatherIconTable[this._weatherIconID]);
        }
예제 #6
0
        internal void Configure(Config configuration)
        {
            Arm     = new Arm(configuration.Constants, configuration.Environment.Arm);
            Targets = Enumerable.Empty <Target>();
            Food    = new HashSet <Food>();
            Mouth   = null;

            taskTracker  = MakeTaskTracker(configuration.Environment.Task);
            envSimulator = new EnvironmentSimulator(configuration.Constants, Arm, Food);

            initialState = envSimulator.CurrentODEState;
            solver       = new RungeKutta4Solver();
        }
예제 #7
0
        public DevicePanel(View view)
        {
            View = view;

            Title       = new TextView().Font(color: Colors.White, size: 28).X(10).Y(10).Absolute();
            Description = new TextView().Font(color: Colors.White, size: 12).X(10).Y(42).Absolute();

            EnvironmentSimulator.Start();

            var actualHeight = Root.ActualHeight - 90;

            AccelerometerInfo = new TextView().Font(color: Colors.White, size: 15).X(10).Y(actualHeight - 60).Absolute();
            GyroscopeInfo     = new TextView().Font(color: Colors.White, size: 15).X(10).Y(actualHeight - 40).Absolute();
            CompassInfo       = new TextView().Font(color: Colors.White, size: 15).X(10).Y(actualHeight - 20).Absolute();

            Shown.Handle(OnShown);

            ShowValues();
        }
예제 #8
0
        static void Draw(int id)
        {
            GUI.DragWindow(dragRect);
            GUILayout.BeginArea(innerRect);
            {
                EnvironmentSimulator sim = Manager.Map.Instance.Simulator;

                GUILayout.BeginVertical();
                {
                    Draw_Weather(sim);
                    Draw_Temperature(sim);
                    Draw_Time(sim);
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndArea();

            shouldUpdate = false;
        }
예제 #9
0
        static void Draw_Time(EnvironmentSimulator sim)
        {
            EnviroTime time = sim.EnviroSky.GameTime;

            bool flag0, flag1, flag2, flag3, flag4;
            int  year, day, hour, minute, second;

            if (shouldUpdate)
            {
                temp_year   = time.Years.ToString();
                temp_day    = time.Days.ToString();
                temp_hour   = time.Hours.ToString();
                temp_minute = time.Minutes.ToString();
                temp_second = time.Seconds.ToString();
            }

            GUILayout.Label("日期 和 时间", headerStyle);

            GUILayout.BeginHorizontal();
            {
                temp_year = Draw_Time_Field("年", temp_year, out year, out flag0);
                temp_day  = Draw_Time_Field("天", temp_day, out day, out flag1);
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            {
                temp_hour   = Draw_Time_Field("小时", temp_hour, out hour, out flag2);
                temp_minute = Draw_Time_Field("分钟", temp_minute, out minute, out flag3);
                temp_second = Draw_Time_Field("秒", temp_second, out second, out flag4);
            }
            GUILayout.EndHorizontal();

            if (GUILayout.Button("更新 日期 和 时间") && flag0 && flag1 && flag2 && flag3 && flag4)
            {
                sim.EnviroSky.SetTime(year, day, hour, minute, second);

                temp_year   = time.Years.ToString();
                temp_day    = time.Days.ToString();
                temp_hour   = time.Hours.ToString();
                temp_minute = time.Minutes.ToString();
                temp_second = time.Seconds.ToString();
            }
        }
예제 #10
0
        static void Draw_Temperature(EnvironmentSimulator sim)
        {
            GUILayout.Label("气温", headerStyle);

            if (shouldUpdate)
            {
                temp_temperature = ((int)sim.TemperatureValue).ToString();
            }

            GUILayout.BeginHorizontal();
            {
                bool flag = int.TryParse(temp_temperature = GUILayout.TextField(temp_temperature), out int val);

                if (GUILayout.Button("更新", GUILayout.Width(80f)) && flag)
                {
                    sim.TemperatureValue = val;
                    temp_temperature     = ((int)sim.TemperatureValue).ToString();
                }
            }
            GUILayout.EndHorizontal();
        }
예제 #11
0
        public override void OnTimeZoneChanged(EnvironmentSimulator _simulator)
        {
            bool flag = _simulator.Weather == Weather.Rain || _simulator.Weather == Weather.Storm;

            if (_simulator.TimeZone == AIProject.TimeZone.Night)
            {
                if (this.CurrentState == AnimalState.Depop)
                {
                    return;
                }
                this.SetState(AnimalState.Depop, (Action)null);
            }
            else
            {
                if (this.CurrentState != AnimalState.Depop || flag || this.forcedDepop)
                {
                    return;
                }
                this.SetState(AnimalState.Locomotion, (Action)null);
            }
        }
예제 #12
0
        public override void OnWeatherChanged(EnvironmentSimulator _simulator)
        {
            bool flag = _simulator.TimeZone == AIProject.TimeZone.Night;

            switch (_simulator.Weather)
            {
            case Weather.Rain:
            case Weather.Storm:
                if (this.CurrentState == AnimalState.Depop)
                {
                    break;
                }
                this.SetState(AnimalState.Depop, (Action)null);
                break;

            default:
                if (this.CurrentState != AnimalState.Depop || flag || this.forcedDepop)
                {
                    break;
                }
                this.SetState(AnimalState.Locomotion, (Action)null);
                break;
            }
        }