public Timer2(float maxtime = 0)
 {
     CurrentTime = 0;
     if (maxtime == 0)
     {
         hasMaxTime = false;
     }
     else
     {
         hasMaxTime = true;
     }
     MaxTime = maxtime;
     TimeMgr.AddTimer(this);
 }
Beispiel #2
0
        static public void Update()
        {
            TimeMgr.Update();

            if (itemsToRemove.Count > 0)
            {
                for (int i = 0; i < itemsToRemove.Count; i++)
                {
                    items.Remove(itemsToRemove[i]);
                }
                itemsToRemove.Clear();
            }

            for (int i = 0; i < items.Count; i++)
            {
                items[i].Update();
            }
        }
Beispiel #3
0
        //Inizializzazione
        static Game()
        {
            GameSetting();

            GfxMgr.LoadAll();
            TimeMgr.Init();

            AllScenes = new Scene[]
            {
                new LogoScene(),
                new MenuScene(),
                new PlayScene(),
            };

            for (int i = 0; i < AllScenes.Length; i++)
            {
                if (i - 1 >= 0)
                {
                    AllScenes[i].PreviousScene = AllScenes[i - 1];
                }
                if (i + 1 < AllScenes.Length)
                {
                    AllScenes[i].NextScene = AllScenes[i + 1];
                }
            }

            CurrentScene = AllScenes[(int)SceneType.Title];
            CurrentScene.Start();

            #region Old Scenes
            // titlescene = new TitleScene();
            // menuscene = new MenuScene();
            // playscene = new PlayScene();
            // //gameoverscene = new GameOverScene();
            //
            // CurrentScene = titlescene;
            // //CurrentScene = playscene;
            // //titlescene.NextScene = playscene;
            // titlescene.NextScene = menuscene;
            // menuscene.PreviousScene = titlescene;
            // menuscene.NextScene = playscene;
            // playscene.PreviousScene = menuscene;
            // //playscene.PreviousScene = titlescene;
            // playscene.NextScene = null;
            // //playscene.NextScene = gameoverscene;
            // //gameoverscene.PreviousScene = playscene;
            // //gameoverscene.NextScene = null;
            // titlescene.Start();
            // //playscene.Start();
            #endregion

            string[] joysticks = window.Joysticks;
            for (int i = 0; i < joysticks.Length; i++)
            {
                if (joysticks[i] != null && joysticks[i] != "Unmapped Controller")
                {
                    numJS++;
                }
            }

            GamepadSetting();
        }
 public void End()
 {
     UpdateMgr.Remove(this);
     TimeMgr.RemoveTimer(this);
 }