Esempio n. 1
0
        private static void Main()
        {
            var gameTime = new GameTime();

            ShuttingDown = false;

            ServiceLocator.NetManager = new NetManager();
            ServiceLocator.WorldManager = new WorldManager();
            ServiceLocator.ScreenManager = new ScreenManager();

            AudioManager.Instance.SfxManager.LoadSounds(Constants.FILEPATH_SFX);
            AudioManager.Instance.MusicManager.LoadMusic(Constants.FILEPATH_MUSIC);

            RenderWindow renderWindow = new RenderWindow(new SFML.Window.VideoMode(800, 600), "CEngineSharp", SFML.Window.Styles.Default);

            ServiceLocator.ScreenManager.AddScreen("mainMenu", new MenuScreen(renderWindow));
            ServiceLocator.ScreenManager.AddScreen("gameScreen", new GameScreen(renderWindow));
            ServiceLocator.ScreenManager.SetActiveScreen("mainMenu");
            GameLoop.Start(gameTime);
        }
Esempio n. 2
0
        public static void Start(GameTime gameTime)
        {
            while (!Client.ShuttingDown)
            {
                gameTime.Update();

                ServiceLocator.NetManager.Update();

                if (Client.InGame && ServiceLocator.WorldManager.PlayerManager.GetPlayer(ServiceLocator.WorldManager.PlayerManager.ClientID) != null)
                {
                    ServiceLocator.WorldManager.PlayerManager.GetPlayer(ServiceLocator.WorldManager.PlayerManager.ClientID).TryMove();

                    foreach (var player in ServiceLocator.WorldManager.PlayerManager.GetPlayers())
                    {
                        player.Update(gameTime);
                    }

                    ServiceLocator.WorldManager.MapManager.Map.Update(gameTime);
                }

                // Render
                ServiceLocator.ScreenManager.Render(gameTime);
            }
        }