Пример #1
0
        public override void Hit(GameObject gameObject)
        {
            if (gameObject is LifeWall wall && !wall.IsDead)
            {
                HitLifeWall(wall);
            }
            if (gameObject is Block block && block.IsSolid)
            {
                HitBlock(block);
            }

            if (gameObject is Boss)
            {
                if (!Boss.IsDeadFlag)
                {
                    Direction dir = CheckDirection(gameObject);
                    CorrectPosition(gameObject);

                    if (dir == Direction.Left || dir == Direction.Right)
                    {
                        var rotation = Rotation;
                        Rotation = 360 - rotation;
                    }
                    else if (dir == Direction.Top || dir == Direction.Bottom)
                    {
                        var rotation = Rotation;
                        Rotation = 180 - rotation;
                    }
                }
            }
            if (gameObject is HealItem)
            {
                LifeWall.HealWall();
            }
        }
Пример #2
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"
                );
        }
Пример #3
0
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     if (IsInScreen() && LifeWall.AllIsDead())
     {
         fallTimer.Update(gameTime);
         GameOverEffect();
     }
 }
Пример #4
0
 public void HitLifeWall(LifeWall wall)
 {
     if (Speed > MaxSpeed / 2 && Velocity.Y != 0)
     {
         sound.PlaySE("wall_hit");
         var rotation = Rotation;
         Rotation = 180 - rotation;
         new DestroyParticle(HitParticle, Position, new Point(16, 16), DestroyParticle.DestroyOption.Up);
     }
     if (mapBottomHit)
     {
         wall.Break();
     }
     CorrectPosition(wall);
 }
Пример #5
0
        public override void Update(GameTime gameTime)
        {
            mapBottomHit = false;
            gunTimer.Update(gameTime);
            if (!IsCharging && Position.Y < -GameDevice.Instance().DisplayModify.Y)
            {
                if (!IsMenu)
                {
                    sound.PlaySE("wall_hit");
                }
                Position = new Vector2(Position.X, -GameDevice.Instance().DisplayModify.Y + 1);
                var rotation = Rotation;
                Rotation = 180 - rotation;
                new DestroyParticle(HitParticle, Position, new Point(16, 16), DestroyParticle.DestroyOption.Down);
            }
            IsCharging = false;
            Velocity   = Front * Speed;
            Speed     -= Deceleration;
            if (Speed < 0)
            {
                Speed = 0;
            }

            if (Input.GetKeyTrigger(Keys.Space) && !IsTitle)
            {
                Speed = 0;
                if (!IsMenu)
                {
                    sound.StoppedSE("shoot", 0);
                    sound.RemoveSE("shoot", 0);
                    sound.CreateSEInstance("charge");
                    sound.CreateSEInstance("charging");
                    sound.PlaySEInstances("charge", 0);
                    haveSound = true;
                }
            }
            if (Input.GetKeyRelease(Keys.Space) && !IsTitle && !IsMenu)
            {
                sound.StoppedSE("charge", 0);
                sound.RemoveSE("charge", 0);
                sound.StoppedSE("charging", 0);
                sound.RemoveSE("charging", 0);
                haveSound = false;
                if (Speed > MaxSpeed / 2)
                {
                    sound.CreateSEInstance("shoot");
                    sound.PlaySEInstances("shoot", 0);
                }
            }
            if (Input.GetKeyState(Keys.Space) && !IsTitle)
            {
                if (haveSound)
                {
                    if (sound.IsStoppedSEInstance("charge", 0))
                    {
                        sound.PlaySEInstances("charging", 0, true);
                    }
                }
                Velocity  = Vector2.Zero;
                Rotation += RotaionSpeed;
                Speed    += ChargeSpeed;
                if (Speed > MaxSpeed)
                {
                    Speed = MaxSpeed;
                }
                IsCharging = true;
            }
            BladeRotation -= (Speed - MaxSpeed / 2) * 2;
            //if (Speed <= MaxSpeed / 2 && gunTimer.Location >= (BulletRate + Speed / (MaxSpeed / 2) / (1 + BulletRate)))
            if (!Velocity.Equals(Vector2.Zero) && Speed <= MaxSpeed / 2 && gunTimer.Location >= BulletRate && !IsMenu)
            {
                gunTimer.Reset();
                //GameObjectManager.Instance.Add(new PlayerBullet(Position + Size.ToVector2() / 2 - new Vector2(8, 8 + Math.Sign(Front.Y) * Size.Y / 2), -Math.Sign(Front.Y)));
                GameObjectManager.Instance.Add(new PlayerBullet(Position + Size.ToVector2() / 2 - new Vector2(8, 8 + Size.Y / 2), -1));
                sound.PlaySE("gun");
            }
            if (!IsTitle && !IsMenu)
            {
                if (LifeWall.AllIsDead())
                {
                    new DestroyParticle(Name, Position, Size, DestroyParticle.DestroyOption.Center);
                    sound.StoppedSE("charge", 0);
                    sound.StoppedSE("charging", 0);
                    IsDead = true;
                }
            }
            new TailParticle(Position + new Vector2(16, 16));
            base.Update(gameTime);
            if (Position.X < Block.BlockSize)
            {
                HitWall(true);
            }
            else if (Position.X > Screen.Width - Block.BlockSize - Size.X)
            {
                HitWall(false);
            }
        }
Пример #6
0
        public void Update(GameTime gameTime)
        {
            if (!fade.IsEnd)
            {
                fade.Update(gameTime);
            }
            if (bossAlert.Initialized)
            {
                bossAlert.Update(gameTime);
            }
            hitStop.Update(gameTime);
            if (hitStop.isHitStop)
            {
                return;
            }
#if DEBUG
            if (Input.GetKeyTrigger(Keys.Enter))
            {
                //シーン移動
                isEndFlag = true;
                next      = Scene.Ending;
            }
#endif

            if (gameObjectManager.Map.CheckAllBlockDead())
            {
                //シーン移動
                isEndFlag = true;
                next      = Scene.GameOver;
            }

            if (!LifeWall.AllIsDead() && !ScrollStop)
            {
                scroll--;
            }
            if (scroll < Screen.Height)
            {
                scroll = Screen.Height;
            }

            if (Menu.GetDifficulty() == Menu.Difficulty.tutorial && !ScrollStop)
            {
                foreach (var height in stopHeights)
                {
                    if (scroll == height)
                    {
                        ScrollStop = true;
                    }
                }
            }
            else if (ScrollStop)
            {
                if (gameObjectManager.Find <Enemy>().FindIndex(enemy => enemy.IsInScreen()) == -1)
                {
                    ScrollStop = false;
                    var blocks = gameObjectManager.Map.GetAllBlockInScreen();
                    foreach (var block in blocks)
                    {
                        if (block.IsSolid)
                        {
                            GameDevice.Instance().GetSound().PlaySE("success");
                            gameObjectManager.Map.ReplaceBlock(block, new Space());
                        }
                    }
                }
            }

            GameDevice.Instance().DisplayModify = new Vector2(0, -scroll + Screen.Height);
            gameObjectManager.Update(gameTime);
            particleManager.Update(gameTime);

            if (gameObjectManager.Find <Boss>().Count == 0)
            {
                isEndFlag = true;
                next      = Scene.Ending;
            }
            if (Menu.GetDifficulty() == Menu.Difficulty.tutorial)
            {
                next = Scene.Title;
            }

            if (scroll == BossAlert.AlertHeight && Menu.GetDifficulty() != Menu.Difficulty.tutorial)
            {
                if (!bossAlert.Initialized)
                {
                    bossAlert.Initialize();
                }
                bossAlert.Update(gameTime);
            }
        }