Exemple #1
0
 public void Initialize()
 {
     isEndFlag = false;
     gameObjectManager.Initialize();
     map    = new Map(GameDevice.Instance());
     player = new Player(new Vector2(32 * 2, 32 * 10), GameDevice.Instance(), gameObjectManager);
     shark  = new Shark(new Vector2(32 * 30, 32 * 10), GameDevice.Instance(), gameObjectManager);
     gameObjectManager.Add(player);
     gameObjectManager.Add(shark);
     map.Load("map.csv", "./csv/");
     timer   = new CountUpTimer(50000);
     timerUI = new TimerUI(timer);
     gameObjectManager.Add(map);
 }
Exemple #2
0
        /// <summary>
        /// 初期化
        /// </summary>
        public void Initialize()
        {
            //シーン終了フラグを初期化
            isEndFlag = false;

            gameObjectManager.Initialize();

            map = new Map();
            map.Load("stage01.csv", "./csv/");//ここで読み込むマップデータを選択

            player = new Player(new Vector2(32 * 2, 32 * 12), gameObjectManager);

            gameObjectManager.Add(map);
            gameObjectManager.Add(player);
        }
Exemple #3
0
        public void Initialize()
        {
            isEndFlag         = false;
            next              = Scene.Ending;
            gameObjectManager = new GameObjectManager();
            particleManager   = new ParticleManager();
            gameObjectManager.Initialize();
            particleManager.Initialize();
            LifeWall.Reset();
            var lifeWalls = LifeWall.GenerateWall(LifeWall.Count);

            gameObjectManager.AddWall(lifeWalls);
            nowMap = mapName[(int)Menu.GetDifficulty()];
            // csvからマップを読み込む場合

            var reader = GameDevice.Instance().GetCSVReader();

            //reader.Read("normal.csv");
            reader.Read(nowMap);
            var map = new Map(reader.GetData());

            gameObjectManager.Add(map);
            scroll     = map.Height;
            ScrollStop = false;
            hitStop    = new HitStop();
            fade       = new FadeIn();

            GameDevice.Instance().GetSound().PlayBGM(
                (Menu.GetDifficulty() == Menu.Difficulty.tutorial || Menu.GetDifficulty() == Menu.Difficulty.easy)
                ? "tutorial"
                : "stage"
                );
        }
        private void SpawnFire(GameSlot fireSlot)
        {
            if (fireDurration > 0)
            {
                if (fireSlot.Contents == GameSlotStatus.Fire)
                {
                    fireSlot.Child.facingDirection = playerSlot.Child.facingDirection;
                    fireSlot.Child.life            = fireDurration;
                }
                else
                {
                    GameObjectManager     manager = sSystemRegistry.GameObjectManager;
                    PyroGameObjectFactory factory = (PyroGameObjectFactory)sSystemRegistry.GameObjectFactory;

                    GameObject fireGameObject = factory.SpawnFire(0, 0, fireDurration);
                    manager.Add(fireGameObject);

                    fireSlot.Setup(GameSlotStatus.Fire, fireGameObject);

                    fireGameObject.SetPosition(GetSlotLocation(fireSlot.Position));
                    fireGameObject.facingDirection = playerSlot.Child.facingDirection;

                    fires.Add(fireSlot);
                }
            }
        }
Exemple #5
0
        public void Initialize()
        {
            objectManager = new GameObjectManager();
            objectManager.Initialize();
            isEndFlag = false;

            map = new Map(GameDevice.Instance());
            map.Load("stagetest.csv");
            player = new Player(new Vector2(64, 700), GameDevice.Instance());
            player.Initialize();
            spear = new Spear(player.GetPosition(), GameDevice.Instance(), player);
            spear.Initialize();
            objectManager.Add(map);
            objectManager.Add(player);
            objectManager.Add(spear);
        }
        private void SpawnBackground()
        {
            PyroGameObjectFactory factory = (PyroGameObjectFactory)sSystemRegistry.GameObjectFactory;
            GameObjectManager     manager = sSystemRegistry.GameObjectManager;

            manager.Add(factory.SpawnBackgroundPlate(0, 0));
        }
        private void SpawnFuel()
        {
            const int maxRandomTries = 5;

            fuelSlot = GetRandomEmptySlot(maxRandomTries);
            if (fuelSlot == null)
            {
                //game has no empty tiles - shorted tail by 1 to allow space then try again
                AdjustFireDurration(-1);
                fuelSlot = GetRandomEmptySlot();

                Debug.Assert(fuelSlot != null, "Failed to spawn another fuel");
                //Need to test this
            }

            GameObjectManager     manager = sSystemRegistry.GameObjectManager;
            PyroGameObjectFactory factory = (PyroGameObjectFactory)sSystemRegistry.GameObjectFactory;

            GameObject fuelGameObject = factory.SpawnFuel(0, 0);

            manager.Add(fuelGameObject);

            //playerSlot.Setup(GameSlotStatus.Player, fireGameObject);
            fuelSlot.Setup(GameSlotStatus.Fuel, fuelGameObject);

            fuelGameObject.SetPosition(GetSlotLocation(fuelSlot.Position));

            //fires.Add(fireSlot);
        }
Exemple #8
0
        public void Initialize()
        {
            IsEndFlag = false;
            gameObjectManager.Initialize();

            //プレイヤーの生成
            player = new Player(startPlayerPosi, startPlayerRota, startOrigin, gameDevice, gameObjectManager);

            ship = new Ship(new Vector2(), 0.0f, new Vector2(), gameDevice, gameObjectManager);

            bermuda = new Bermuda(new Vector2(), new Vector2(), gameDevice, gameObjectManager);

            //プレイヤーにIDを設定
            gameObjectManager.Add(player);
            gameObjectManager.Add(ship);
            gameObjectManager.Add(bermuda);
        }
        public void Initialize()
        {
            IsEndFlag = false;
            gameObjectManager.Initialize();
            num = 0;

            //プレイヤーの生成
            player = new Player(startPlayerPosi, startPlayerRota, startOrigin, gameDevice, gameObjectManager);

            bermuda = new Bermuda(new Vector2(), new Vector2(), gameDevice, gameObjectManager);

            island = new Island(new Vector2(), new Vector2(), gameDevice, gameObjectManager);

            //プレイヤーにIDを設定
            gameObjectManager.Add(player);
            gameObjectManager.Add(bermuda);
            gameObjectManager.Add(island);
            score = 0;
        }
Exemple #10
0
        /// <summary>
        /// 初期化処理(起動時、コンストラクタの後に1度だけ呼ばれる)
        /// </summary>
        protected override void Initialize()
        {
            // この下にロジックを記述
            gameDevice = GameDevice.Instance(Content, GraphicsDevice);

            gameObjectManager.Initialize();
            map = new Map(GameDevice.Instance());
            map.Load("./map.csv");

            gameObjectManager.Add(map);

            player = new Player(new Vector2(64 * 2, 64 * 2), GameDevice.Instance(), gameObjectManager);
            player.SetID(GameObjectID.Player);
            gameObjectManager.Add(player);

            gameObjectManager.SetRespawnPos(player.GetPosition());



            // この上にロジックを記述
            base.Initialize();// 親クラスの初期化処理呼び出し。絶対に消すな!!
        }
        public void SpawnLevelTiles()
        {
            foreach (GameSlot slot in tileSlots)
            {
                GameObjectManager     manager = sSystemRegistry.GameObjectManager;
                PyroGameObjectFactory factory = (PyroGameObjectFactory)sSystemRegistry.GameObjectFactory;

                GameObject tile = factory.SpawnTileEmpty(0, 0);
                manager.Add(tile);

                slot.Setup(GameSlotStatus.Empty, null);

                tile.SetPosition(GetSlotLocation(slot.Position));
            }
        }
Exemple #12
0
        public Game(GameWindow gw, double frameRate)
        {
            this.gw        = gw;
            this.frameRate = frameRate;

            this.camera            = new Camera();
            this.keyboardProcessor = new KeyboardProcessor();
            this.mouseProcessor    = new MouseProcessor();

            this.GameObjectManager = new GameObjectManager();

            GameObjectManager.Add(new BlockSolid(new Vector3(0, 0, 0), 10, 14, 8));
            GameObjectManager.Add(new CubeSolid(new Vector3(0, 0, 20), 10)
            {
                color = new float[] { 0.4f, 0.8f, 0.2f, 0.5f }
            });
            BlockSolid platform = new BlockSolid(new Vector3(0, -80, 0), 400, 2, 400);

            platform.color = new float[4] {
                0.2f, 0.6f, 0.2f, 1.0f
            };

            platform.Collision += (o, e) =>
            {
                (e.solid.physicElements[0] as RigidBody).Gravity = false;
                var dev = e.solid.hitbox.first.Y - platform.hitbox.second.Y;
                e.solid.Pos -= new Vector3(0.0f, dev, 0.0f);
            };

            GameObjectManager.Add(platform);

            spider = ObjLoader.ObjLoader.LoadObj(@"..\..\TestModels\Spider\", "spider.obj", new Vector3(-80, 0, 0));
            spider.physicElements.Add(new RigidBody());
            (spider.physicElements[0] as RigidBody).Gravity = false;
            GameObjectManager.Add(spider);
        }
Exemple #13
0
        public void LoadMap(MapDictionary.MapType type)
        {
            gameObjectManager.Initialize();
            particleManager.Initialize();
            uiManager.Initialize();
            mapType = type;
            var reader = GameDevice.Instance().GetCSVReader();

            reader.Read(MapDictionary.MapNames[(int)mapType]);
            var map = new Map(reader.GetData());

            gameObjectManager.Add(map);
            keyIcon     = new KeyIcon(Vector2.Zero);
            fade        = new Fade(Vector2.Zero, Fade.FadeOption.Out);
            clock       = new Clock(Vector2.Zero);
            backGrounds = new BackGround[] {
                new BackGround1(Vector2.Zero, mapType),
                new BackGroundStar(Vector2.Zero, mapType),
                new BackGround2(Vector2.Zero, mapType),
                new BackGround3(Vector2.Zero, mapType),
            };
        }
        private void SpawnPlayer()
        {
            GameObjectManager     manager = sSystemRegistry.GameObjectManager;
            PyroGameObjectFactory factory = (PyroGameObjectFactory)sSystemRegistry.GameObjectFactory;

            GameObject playerGameObject = factory.SpawnPlayer(0, 0);

            manager.Add(playerGameObject);

            //spawn at center
            Point gameCenter = new Point(GameWidthInSlots / 2, GameHeightInSlots / 2);

            //gameCenter = new Point(19,19);//test wrap
            playerSlot.SetPosition(gameCenter.X, gameCenter.Y);
            playerSlot.Setup(GameSlotStatus.Player, playerGameObject);
            GetGameSlot(gameCenter).Setup(GameSlotStatus.Player, null);

            //spawn facing right
            playerSlot.Child.facingDirection.X = 1;
            playerSlot.Child.facingDirection.Y = 0;

            playerGameObject.SetPosition(GetSlotLocation(playerSlot.Position));
        }
        public FixedSizeArray <GameSlot> GenerateSlots()
        {
            int slotCount = GameWidthInSlots * (GameHeightInSlots);
            FixedSizeArray <GameSlot> result = new FixedSizeArray <GameSlot>(slotCount);

            GameObjectManager     manager = sSystemRegistry.GameObjectManager;
            PyroGameObjectFactory factory = (PyroGameObjectFactory)sSystemRegistry.GameObjectFactory;

            for (int xx = 0; xx < slotCount; xx++)
            {
                int xPos = xx / GameWidthInSlots;
                int yPos = xx % GameWidthInSlots;

                GameObject emptyTile = factory.SpawnTileEmpty(xPos, yPos);
                manager.Add(emptyTile);

                GameSlot slot = new GameSlot(xPos, yPos);

                result.Add(slot);
            }

            return(result);
        }
Exemple #16
0
 public void Initialize()
 {
     gameObject.Initialize();
     gameObject.Add(playerBullet);
     player = new Player(new Vector2(420, 600),
                         GameDevice.Instance(), gameObject, gameObject);
     optionNumber = 0;
     gameObject.Add(player);
     gameObject.Add(option);
     isEnd = false;
 }