Пример #1
0
        /// Initialize method:
        /// The following method will instantiate objects used throughout the program and set up default values for variables.

        protected override void Initialize()
        {
            try
            {
                mainID           = new InformationDisplay();
                mainID.GameError = false;
            }
            catch
            {
                Console.WriteLine("[WARNING] A game error has occurred! " + "GE0000MID");
            }

            try
            {
                Window.Title = "Chevron Shards";

                // WINDOW SIZE
                graphics.PreferredBackBufferWidth  = 768;
                graphics.PreferredBackBufferHeight = 720;
                graphics.ApplyChanges();
            }
            catch
            {
                // IF AN ERROR OCCURS WHILE LOADING A TEXTURE
                mainID.GameErrorCode = "GE0006WIN";
                Console.WriteLine("[WARNING] A game error has occurred! " + mainID.GameErrorCode);
                mainID.GameError = true;
            }

            try{
                Console.WriteLine("Game is Initialising...");

                // TITLE SCREEN
                mainID.ShowTitleScreen = true;
                mainID.ShowLoadScreen  = false;
                mainID.ShowHUD         = false;

                //mainLG = new LoadGame();
                mainLG     = new LoadGame();
                mainPS     = new PauseScreen();
                mainLS     = new LoadScreen();
                mainHUD    = new HUD();
                mainPlayer = new Player();
                mainOWM    = new OverworldManager();        // OWM stands for OverWorldManager
                mainDM     = new DungeonManager();          // DM stands for DungeonManager
                mainBLM    = new BossLevelManager();        // BLM stands for BossLevelManager
                mainEM     = new EnemyManager();            // EM stands for EnemyManager
                mainIM     = new ItemManager();             // IM stands for ItemManager

                mainID.SplashScreenTime = 0;

                mainHUD.Initialise();

                mainPlayer.InOverworld = true;                 // set player location to overworld
                mainPlayer.InDungeon   = false;
                mainPlayer.InBossLevel = false;

                InterfaceUpdate();

                areaInt.ChangeSec = false;

                mainID.GamePaused = false;

                mainPlayer.AllowEntityMovement = false;
                mainPlayer.AllowWeaponFire     = false;
                mainPlayer.PlayerWeaponFiring  = false;
                mainPlayer.NewPlayerWeaponFire = true;
                mainPlayer.DrawWeapon          = false;

                mainPlayer.AllowEntityDirChange = true;
                mainPlayer.Orientation          = 'R';
                mainPlayer.CurrentWeapon        = "Sword";
                mainPlayer.ChangeWeapon();

                mainID.ShowPlayer   = false;
                mainID.NewEnemyList = true;

                mainID.ShowItems     = false;
                mainID.NewItemList   = true;
                mainID.EraseItemList = false;

                mainID.EnergyBarrierStatus = false;

                mainID.GameOver             = false;
                mainID.GameOverAniCompleted = false;
                mainID.GameOverTime         = 0;
                mainID.GameOverStoryTime    = 0;


                mainID.ElapsedTime = 0f;

                mainID.CurrentFrame = new Point(0, 0);

                mainID.EntityKilled       = false;
                mainID.KillAnimationTimer = 0;
            }
            catch
            {
                mainID.GameErrorCode = "GE0007INI";
                Console.WriteLine("[WARNING] A game error has occurred! " + mainID.GameErrorCode);
                mainID.GameError = true;
            }

            base.Initialize();             // THIS MUST BE LAST
        }