Esempio n. 1
0
        public override void Update()
        {
            if (ScreenModal.isActive)
            {
                ScreenModal.Update();
            }
            else
            {
                btn_start.Update();
                btn_exit.Update();
                btn_start_withoutload.Update();
            }

            base.Update();
        }
Esempio n. 2
0
        public override void Update()
        {
            btn_cancel.Update();

            if (ScreenModal.isActive)
            {
                ScreenModal.Update();
            }
            else
            {
                if (!GeneticAlgorithm.Loading)
                {
                    ScreenManager.SetScreen("SC_EVO");
                }
            }

            base.Update();
        }
Esempio n. 3
0
        public override void Update()
        {
            if (ScreenModal?.isActive == false)
            {
                GameHelper.Window.Title = "Time: " + Math.Round(GeneticAlgorithm.ElapsedGenerationTime) + " / " + GeneticAlgorithm.GenerationTime + " Generation: " + GeneticAlgorithm.Generation;

                btn_exit.Update();
                btn_debug.Update();
                btn_showNetwork.Update();
                btn_evoSpeed_1.Update();
                btn_evoSpeed_5.Update();
                btn_evoSpeed_10.Update();
                btn_pauseEvo.Update();
                btn_autoSelectOnNewGeneration.Update();
                btn_autoSelectBestPerformer.Update();
                btn_openConsole.Update();
                btn_openGrapher.Update();
                btn_resumeEvolution.Update();

                if (!USING_CONSOLE)
                {
                    #region Camera Handling
                    Camera.Instance.SetFocalPoint(camPos, false);
                    Camera.Instance.Update();

                    if (InputManager.ScrolledUp())
                    {
                        Camera.Instance.Zoom *= 1.1f;
                    }
                    if (InputManager.ScrolledDown())
                    {
                        Camera.Instance.Zoom /= 1.1f;
                    }

                    if (InputManager.KeyPressing(Microsoft.Xna.Framework.Input.Keys.W))
                    {
                        FOLLOW_SELECTED = false;
                        camPos         += new Vector2(0, -cameraSpeed / Camera.Instance.Zoom);
                    }
                    if (InputManager.KeyPressing(Microsoft.Xna.Framework.Input.Keys.S))
                    {
                        FOLLOW_SELECTED = false;
                        camPos         += new Vector2(0, cameraSpeed / Camera.Instance.Zoom);
                    }
                    if (InputManager.KeyPressing(Microsoft.Xna.Framework.Input.Keys.A))
                    {
                        FOLLOW_SELECTED = false;
                        camPos         += new Vector2(-cameraSpeed / Camera.Instance.Zoom, 0);
                    }
                    if (InputManager.KeyPressing(Microsoft.Xna.Framework.Input.Keys.D))
                    {
                        FOLLOW_SELECTED = false;
                        camPos         += new Vector2(cameraSpeed / Camera.Instance.Zoom, 0);
                    }
                    #endregion

                    if (InputManager.PressedMouseLeft())
                    {
                        foreach (Evolvi e in GeneticAlgorithm.CurrentGeneration)
                        {
                            if (InputManager.MouseBoxWorld.Intersects(e.CollisionBox))
                            {
                                SELECTED_EVOLVI = e;
                                break;
                            }
                        }
                    }

                    if (InputManager.KeyPressed(Microsoft.Xna.Framework.Input.Keys.F))
                    {
                        FOLLOW_SELECTED = true;
                    }
                }

                if (USING_CONSOLE && InputManager.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Escape))
                {
                    USING_CONSOLE = false;
                }

                if (AUTOSELECT_BEST_PERFORMER && GeneticAlgorithm.CurrentGeneration.Count > 0)
                {
                    SELECTED_EVOLVI = GeneticAlgorithm.SortFittest().Last();
                }

                if (FOLLOW_SELECTED && SELECTED_EVOLVI != null)
                {
                    camPos = SELECTED_EVOLVI.Position;
                }

                if (USING_CONSOLE)
                {
                    MyConsole.Update();
                }

                if (MyGrapher.IsActive)
                {
                    MyGrapher.Update();
                }

                if (MyIndividualViewer.IsActive)
                {
                    MyIndividualViewer.Update();
                }

                GeneticAlgorithm.Update(GameHelper.GameTime);

                selectedAngle += 0.05f;


                base.Update();
            }
            else
            {
                ScreenModal.Update();
            }
        }