Esempio n. 1
0
        public void Initialize(SceneType scene)
        {
            endFlag   = false;
            nextScene = SceneType.LoadTown;

            if (scene == SceneType.Pause)
            {
                return;
            }

            stageManager = gameManager.StageManager;
            currentFloor = stageManager.CurrentFloor();

            #region Map初期化
            map = gameManager.GetDungeonMap();      //生成したマップを取得
            if (map == null)                        //エラー対策 マップが正常に生成されてなかったらLoadingに戻る
            {
                nextScene = SceneType.LoadMap;
                endFlag   = true;
                return;
            }

            map.Initialize(gameManager.BlockStyle);                       //マップを初期化
            map.SetExitColor(stageManager.ConstactColor());
            map.SwitchDrawExit(false);
            #endregion

            #region MapItemの初期化処理
            mapItemManager = new MapItemManager(gameManager, gameDevice);
            mapItemManager.Initialize();
            #endregion

            Vector3 position = new Vector3(
                map.EntryPoint.X * MapDef.TILE_SIZE,
                MapDef.TILE_SIZE / 2,
                map.EntryPoint.Y * MapDef.TILE_SIZE);

            pManager = new ParticleManager(gameDevice);
            pManager.Initialize();

            characterManager = new CharacterManager(gameDevice, gameManager);

            ui = new DungeonUI(gameManager, gameDevice);

            characterManager.Initialize(ui, mapItemManager);
            characterManager.AddPlayer(position, pManager, gameManager);
            //characterManager.AddCharacter(characterManager.Enemys()[4].Clone(bossPosition));

            GeneratBoss();

            #region カメラ初期化
            angle = 0;
            gameDevice.MainProjector.Initialize(characterManager.GetPlayer().GetPosition);       //カメラを初期化
            #endregion

            background = new FogBackground(gameDevice);
        }
Esempio n. 2
0
        public void ShutDown()
        {
            if (nextScene == SceneType.Pause)       //次のシーンがPauseだったら以下のものShutdownしない
            {
                return;
            }

            map.Clear();                            //マップ解放
            map = null;
            gameManager.ReleaseMap();

            mapItemManager.Initialize();            //Item解放
            mapItemManager = null;

            gameManager.EnemySetting.Clear();       //SpawnSettingを削除

            ui = null;
        }
Esempio n. 3
0
        public void ShutDown()
        {
            if (nextScene == SceneType.Pause)
            {
                return;
            }

            map.Clear();                            //マップ解放
            map = null;
            gameManager.ReleaseMap();

            mapItemManager.Initialize();            //Item解放
            mapItemManager = null;

            pManager.Clear();
            pManager         = null;
            characterManager = null;

            gameManager.EnemySetting.Clear();

            ui = null;

            stageManager.ReleaseBossBGM();
        }
Esempio n. 4
0
        public void Initialize(SceneType lastScene)
        {
            endFlag   = false;                      //終了フラグ初期化
            nextScene = SceneType.LoadMap;
            if (lastScene == SceneType.Pause)       //Pauseから来た場合は以下のもの初期化しない
            {
                return;
            }

            pManager.Initialize();
            gameDevice.MainProjector.SetRelativePosition(new Vector3(0, 6, 12f));
            currentFloor = stageManager.CurrentFloor();

            #region Map初期化
            map = gameManager.GetDungeonMap();      //生成したマップを取得
            if (map == null)                        //エラー対策 マップが正常に生成されてなかったらLoadingに戻る
            {
                nextScene = SceneType.LoadMap;
                endFlag   = true;
                return;
            }
            map.Initialize(gameManager.BlockStyle);                       //マップを初期化
            map.SetExitColor(stageManager.ConstactColor());
            #endregion

            #region Item初期化
            mapItemManager = new MapItemManager(gameManager, gameDevice);
            mapItemManager.Initialize();
            int itemAmount = stageManager.CurrentFloor() / 10 + stageManager.StageSize() / 10;    //初期落ちているアイテムの数
            itemAmount = gameDevice.Random.Next(0, itemAmount + 1);
            for (int i = 0; i < itemAmount; i++)
            {
                Vector3 randomSpace = map.RandomSpace();
                if (randomSpace == Vector3.Zero)                    //Error対策
                {
                    break;
                }

                mapItemManager.AddItemByPossibility(randomSpace, 0.9f, 0.3f);
            }
            #endregion

            ///飯泉より キャラクターマネージャのinitの前にずらしました
            ui = new DungeonUI(gameManager, gameDevice);

            Vector3 position = new Vector3(
                map.EntryPoint.X * MapDef.TILE_SIZE,
                MapDef.TILE_SIZE / 2,
                map.EntryPoint.Y * MapDef.TILE_SIZE);
            characterManager.Initialize(ui, mapItemManager);
            characterManager.AddPlayer(position, pManager, gameManager);
            //var d = new int[2];
            //d[0] = 3;
            //d[1] = 2;
            ////配列を渡せばその中からランダムで、ID単体を渡せばそれのみをスポーンさせます
            //characterManager.AddSpawner(new Spawner(500, characterManager.GetPlayer().Position, d, 10,1, characterManager));
            //characterManager.AddSpawner(new Spawner(500, characterManager.GetPlayer().Position, 1, 10, 1, characterManager));

            int spawnerAmount =
                stageManager.StageSize() / 3 +             //サイズ補正
                //stageManager.CurrentFloor() / 5 +         //Floor補正(難しいのでコメントアウト)
                stageManager.CurrentDungeonNum() / 3;      //ダンジョンの難易度補正

            GenerateSpawner(spawnerAmount);

            #region カメラ初期化
            angle = 0;
            gameDevice.MainProjector.Initialize(characterManager.GetPlayer().GetPosition);       //カメラを初期化
            #endregion


            background = new FogBackground(gameDevice);
        }