Пример #1
0
 // Start is called before the first frame update
 void Start()
 {
     isInvincible    = false;
     invincibleTimer = 0;
     manager         = GameObject.FindGameObjectWithTag("PlaySceneManager");
     playScene       = manager.GetComponent <GamePlayScene>();
     audioSource     = GetComponent <AudioSource>();
 }
Пример #2
0
    private GamePlayScene()
    {
        if (_instance != null)
        {
            return;
        }

        _instance = this;
    }
Пример #3
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            KeyboardState prev = kboard;

            kboard = Keyboard.GetState();
            if (scene1.Enabled)
            {
                if (kboard.IsKeyDown(Keys.Space) && prev.IsKeyUp(Keys.Space))
                {
                    this.scene1.Hide();
                    this.scene2.Show();
                }
                else if (kboard.IsKeyDown(Keys.Enter) && prev.IsKeyUp(Keys.Enter))
                {
                    this.scene1.Hide();
                    this.scene3.Show();
                }
            }
            else if (scene2.Enabled)
            {
                if (kboard.IsKeyDown(Keys.Escape) && prev.IsKeyUp(Keys.Escape))
                {
                    this.scene2.Hide();
                    this.scene1.Show();
                }
            }
            else if (scene3.Enabled)
            {
                if (kboard.IsKeyDown(Keys.Escape) && prev.IsKeyUp(Keys.Escape))
                {
                    this.scene3.Hide();
                    this.scene3 = new GamePlayScene(this, scene4);
                    Components.Add(scene3);
                    this.scene1.Show();
                }
            }
            else if (scene4.Enabled)
            {
                if (kboard.IsKeyDown(Keys.Escape) && prev.IsKeyUp(Keys.Escape))
                {
                    this.scene4.Hide();
                    this.scene3 = new GamePlayScene(this, scene4);
                    Components.Add(scene3);
                    this.scene1.Show();
                }
            }
            // TODO: Add your update logic here

            base.Update(gameTime);
        }
Пример #4
0
 public BrickSprite(Game game, BallSprite ballSprite, ExplosionSprite explosionSprite, Vector2 brickPos, GamePlayScene scene, String brickColor)
     : base(game)
 {
     this.game            = game;
     this.currentGame     = (Game1)game;
     this.ballSprite      = ballSprite;
     this.explosionSprite = explosionSprite;
     this.spriteBatch     = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
     this.brickSprite     = game.Content.Load <Texture2D>(brickColor);
     this.brickPos        = brickPos;
     this.scene           = scene;
 }
Пример #5
0
        /// <summary>
        /// Performs further custom initialization for this instance.
        /// </summary>
        /// <remarks>
        /// By default this method does nothing.
        /// </remarks>
        protected override void Initialize()
        {
            base.Initialize();

            this.scene     = (GamePlayScene)this.Owner.Scene;
            this.backScene = WaveServices.ScreenContextManager.FindContextByName("BackContext")
                             .FindScene <BackgroundScene>();

            this.soundManager = WaveServices.GetService <SoundManager>();

            foreach (var block in this.avaibleBlocks)
            {
                this.Owner.AddChild(block.Entity);
                block.Entity.Enabled = false;
            }

            this.Reset();
        }
Пример #6
0
        /// <summary>
        /// 初期化処理(起動時、コンストラクタの後に1度だけ呼ばれる)
        /// </summary>
        protected override void Initialize()
        {
            // この下にロジックを記述
            gameDevice = GameDevice.Instance(Content, GraphicsDevice);

            renderer = gameDevice.GetRenderer();

            // この下にロジックを記述
            renderer.LoadContent("black");
            renderer.LoadContent("gyoza");
            renderer.LoadContent("kamato");
            renderer.LoadContent("pipo-btleffect");
            renderer.LoadContent("stage");
            renderer.LoadContent("white");
            renderer.LoadContent("particle");
            renderer.LoadContent("particleBlue");
            renderer.LoadContent("EnemyBullet");
            renderer.LoadContent("Cloud");



            Sound  sound    = gameDevice.GetSound();
            string filepath = "";       //after

            sound.LoadBGM("gameplaybgm", filepath);

            sound.LoadSE("shot", filepath);
            sound.LoadSE("die", filepath);
            sound.LoadSE("hit", filepath);
            sound.LoadSE("kill", filepath);


            sceneManager = new SceneManager();

            IScene gamePlayScene = new GamePlayScene();

            sceneManager.Add(Scene.Scene.GamePlay, gamePlayScene);
            sceneManager.Add(Scene.Scene.Ending, new Ending(gamePlayScene));



            // この上にロジックを記述
            base.Initialize();            // 親クラスの初期化処理呼び出し。絶対に消すな!!
        }
Пример #7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            this.spriteBatch = new SpriteBatch(GraphicsDevice);

            Services.AddService(typeof(SpriteBatch), spriteBatch);
            this.scene1 = new OpeningScene(this);
            this.scene2 = new InstructionsScene(this, scene1);
            this.scene4 = new GameOverScene(this);
            this.scene3 = new GamePlayScene(this, scene4);
            this.scene1.Show();

            Components.Add(scene1);
            Components.Add(scene2);
            Components.Add(scene3);
            Components.Add(scene4);

            // TODO: use this.Content to load your game content here
        }
Пример #8
0
        public BallSprite(Game game, GamePlayScene scene) : base(game)
        {
            this.game         = game;
            this.scene        = scene;
            this.spriteBatch  = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
            this.ballSprite   = game.Content.Load <Texture2D>("ball2");
            this.ballPosition = new Vector2(game.GraphicsDevice.Viewport.Width / 2 - ballSprite.Width / 2, game.GraphicsDevice.Viewport.Height - this.ballSprite.Height - 37);

            Random rnd        = new Random();
            int    xDirection = rnd.Next(0, 2);

            if (xDirection == 0)
            {
                xDirection = 1;
            }
            else
            {
                xDirection = -1;
            }
            this.ballSpeed = new Vector2(xDirection * rnd.Next(MIN_SPEED, MAX_SPEED), -rnd.Next(MIN_SPEED, MAX_SPEED));
        }
 public VictoryLayer(GamePlayScene gameplay)
     : base(gameplay)
 {
 }
Пример #10
0
 /// <summary>
 /// Handles the EntityInitialized event of the entity control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 private void entity_EntityInitialized(object sender, EventArgs e)
 {
     this.gamePlayScene = this.entity.Scene as GamePlayScene;
     this.hubPanel = this.entity.Scene.EntityManager.Find<HubPanel>("HubPanel");
     this.Life = 100;            
 }
Пример #11
0
 // Start is called before the first frame update
 void Start()
 {
     manager   = GameObject.FindGameObjectWithTag("PlaySceneManager");
     playScene = manager.GetComponent <GamePlayScene>();
 }
Пример #12
0
        public StadisticsPanel()
        {
            this.scores   = 0;
            this.accuracy = 0;

            this.entity = new Entity("StadisticsPanel")
                          .AddComponent(new Transform2D())
                          .AddComponent(new PanelControl(1024, 460))
                          .AddComponent(new PanelControlRenderer())
                          .AddChild(new Image(WaveContent.Assets.Textures.bg_final_score_PNG)
            {
                DrawOrder = 0.6f,
            }.Entity);

            // Score text
            this.scoresText = new TextBlock()
            {
                FontPath            = WaveContent.Assets.Fonts.Gotham_Bold_16_ttf,
                Width               = 450,
                Height              = 80,
                Text                = "<rtf Foreground=\"#FECC56\">SCORES: </rtf>" + scores,
                RichTextEnabled     = true,
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin              = new Thickness(0, 200, 0, 0),
            };
            this.entity.AddChild(this.scoresText.Entity);

            // Accuracy text
            this.accuracyText = new TextBlock()
            {
                FontPath            = WaveContent.Assets.Fonts.Gotham_Bold_16_ttf,
                Width               = 450,
                Height              = 80,
                RichTextEnabled     = true,
                Text                = "<rtf Foreground=\"#FECC56\">ACCURACY: </rtf>" + accuracy + "%",
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin              = new Thickness(0, 280, 0, 0),
            };
            this.entity.AddChild(this.accuracyText.Entity);

            // Restart button
            Button restart = new Button()
            {
                Text                   = string.Empty,
                IsBorder               = false,
                BackgroundImage        = WaveContent.Assets.Textures.restart_bt_PNG,
                PressedBackgroundImage = WaveContent.Assets.Textures.restart_bt_pressed_PNG,
                Margin                 = new Thickness(351, 382, 0, 0),
            };

            restart.Click += (s, o) =>
            {
                var           currentContext = WaveServices.ScreenContextManager.CurrentContext;
                GamePlayScene gamePlayScene  = currentContext.FindScene <GamePlayScene>();
                gamePlayScene.CurrentState = GamePlayScene.States.HurryUp;
                SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Button);
            };
            this.entity.AddChild(restart.Entity);

            // Exit button
            Button exit = new Button()
            {
                Text                   = string.Empty,
                IsBorder               = false,
                BackgroundImage        = WaveContent.Assets.Textures.exit_bt_PNG,
                PressedBackgroundImage = WaveContent.Assets.Textures.exit_bt_pressed_PNG,
                Margin                 = new Thickness(552, 382, 0, 0),
            };

            exit.Click += (s, o) =>
            {
                var           currentContext = WaveServices.ScreenContextManager.CurrentContext;
                GamePlayScene gamePlayScene  = currentContext.FindScene <GamePlayScene>();
                gamePlayScene.CurrentState = GamePlayScene.States.TapToStart;
                SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Button);
            };
            this.entity.AddChild(exit.Entity);
        }
Пример #13
0
 /// <summary>
 /// Handles the EntityInitialized event of the entity control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 private void entity_EntityInitialized(object sender, EventArgs e)
 {
     this.gamePlayScene = this.entity.Scene as GamePlayScene;
     this.hubPanel      = this.entity.Scene.EntityManager.Find <HubPanel>("HubPanel");
     this.Life          = 100;
 }