Пример #1
0
        /// <summary>
        /// @brief 更新関数
        /// </summary>
        public override void Update()
        {
            if (CountDown())
            {
                for (int i = 0; i < Magazine; ++i)
                {
                    var sf = new ContainerFactory((GameContainer g) =>
                    {
                        g.AddComponent(new Shot(g, i * space, Speed, Position.WorldPosition));

                        var b = new BillboardRenderer(g, "弾.png");
                        b.Scale = 15.0f;
                        g.AddComponent(b);

                        var col = new RectCollider(g, (Collider c) =>
                        {
                            var target = c.Container.GetComponent<Player>();
                            if (target != null)
                            {
                                GameContainer.Destroy(g);
                            }
                        });
                        col.Width = 10.0f;
                        col.Height = 10.0f;

                        g.AddComponent(col);
                    });
                    sf.Create();
                }
            }
        }
Пример #2
0
        public override GameContainer Create()
        {
            var gc = new GameContainer(Parent);

            gc.Position.LocalPosition = Bit.Position.WorldPosition;
            gc.Position.LocalPosition.z = 0.0f;
            gc.AddComponent(new RaypierTrail(gc, Bit.Angle));
            var br = new BillboardRenderer(gc, "dummy2.png");
            br.Scale = 32.0f;
            gc.AddComponent(br);
            var bra = new BillboardRenderer(gc, "dummy2.png");
            bra.Scale = 16.0f;
            gc.AddComponent(bra);
            var col = new RectCollider(gc, (Collider g) =>
            {
                DX.DrawString(0, 400, "hit", DX.GetColor(255, 255, 255));
                var a = g.Container.GetComponent<EnemyInformation>();
                if(a != null){
                    a.Damage(10);
                    GameContainer.Destroy(gc);
                }

            });

            col.Width = 64.0f;
            col.Height = 64.0f;

            gc.AddComponent(col);

            Option(gc);

            return gc;
        }
Пример #3
0
        /// <summary>
        /// @brief 垂直なショットを撃つ関数
        /// </summary>
        public override void Update()
        {
            if (CountDown())
            {
                if (AimFlag)
                {
                    Vector2 Direction = new Vector2();
                    Direction = Aim();
                    Angle = (float)(Math.Atan2(Direction.y, Direction.x));
                }
                var sf = new ContainerFactory((GameContainer g) =>
                {
                    g.AddComponent(new Shot(g, -Angle, Speed, Position.WorldPosition));

                    var b = new BillboardRenderer(g, "dummy.png");
                    b.Scale = 5.0f;
                    g.AddComponent(b);

                    var col = new RectCollider(g, (Collider c) =>
                    {
                        var target = c.Container.GetComponent<Player>();
                        if (target != null)
                        {
                            GameContainer.Destroy(g);
                        }
                    });
                    col.Width = 10.0f;
                    col.Height = 10.0f;

                    g.AddComponent(col);
                });

                sf.Create();
            }
        }
Пример #4
0
        /// <summary>
        /// @brief 偶数Wayの生成部分
        /// </summary>
        private void EvenShot()
        {
            for (int i = 1; i <= Magazine / 2.0f; ++i)
            {
                var sf = new ContainerFactory((GameContainer g) =>
                {
                    if (i == 1)
                    {
                        g.AddComponent(new Shot(g, -Angle + Theta / 2, Speed, Position.WorldPosition));
                    }
                    else
                    {
                        g.AddComponent(new Shot(g, -Angle + Theta * i - Theta / 2, Speed, Position.WorldPosition));
                    }
                    var b = new BillboardRenderer(g, "hisiga.png");
                    b.Scale = 5.0f;
                    g.AddComponent(b);

                    var col = new RectCollider(g, (Collider c) =>
                    {
                        var target = c.Container.GetComponent<Player>();
                        if (target != null)
                        {
                            GameContainer.Destroy(g);
                        }
                    });
                    col.Width = 10.0f;
                    col.Height = 10.0f;

                    g.AddComponent(col);
                });

                sf.Create();

                var sf2 = new ContainerFactory((GameContainer g) =>
                {
                    if (i == 1)
                    {
                        g.AddComponent(new Shot(g, -Angle - Theta / 2, Speed, Position.WorldPosition));
                    }
                    else
                    {
                        g.AddComponent(new Shot(g, -Angle - Theta * i + Theta / 2, Speed, Position.WorldPosition));
                    }
                    var b = new BillboardRenderer(g, "hisiga.png");
                    b.Scale = 5.0f;
                    g.AddComponent(b);

                    var col = new RectCollider(g, (Collider c) =>
                    {
                        var target = c.Container.GetComponent<Player>();
                        if (target != null)
                        {
                            GameContainer.Destroy(g);
                        }
                    });
                    col.Width = 10.0f;
                    col.Height = 10.0f;

                    g.AddComponent(col);
                });

                sf2.Create();
            }
        }
Пример #5
0
        /// <summary>
        /// @brief コンストラクタ
        /// </summary>
        public override void Update()
        {
            --Count;
            if (Count < 0)
            {
                Count = 15;
            }

            if (Position.LocalPosition.x < -1600 || Position.LocalPosition.x > 1600 ||
                Position.LocalPosition.y < -1600 || Position.LocalPosition.y > 1600)
            {
                // TODO:外に出たら破棄する
                GameContainer.Destroy(Container);
            }
            if (Life <= 0)
            {
                GameContainer.Destroy(Container);

                var gc = new GameContainer(Game.Instance.SceneController.CurrentScene.Root.Position.FindChild("Explosion").Container);
                gc.Position.LocalPosition = Position.LocalPosition;
                var spriteRenderer = new BillboardRenderer(gc);
                spriteRenderer.Scale = 64.0f;
                var animator = new Animator(gc, spriteRenderer, "explosion.png", 4, 4, 1, 512, 512, true);
                animator.UpdateFrame = 3;
                gc.AddComponent(spriteRenderer);
                gc.AddComponent(animator);

                SC.Score += 100;

                animator.OnFinishAnimation = (Animator a) =>
                {
                    GameContainer.Destroy(a.Container);
                };

            }
        }
Пример #6
0
        /// <summary>
        /// @brief 更新処理
        /// </summary>
        public override void Update()
        {
            if (Index == BitIndex.BIT_LEFT)
            {
                DX.DrawBox(300, 780, 300 + 100 * Energy / MaxEnergy, 800, DX.GetColor(0, 255, 100), DX.TRUE);
            }
            else
            {
                DX.DrawBox(1300 - 100 * Energy / MaxEnergy, 780, 1300, 800, DX.GetColor(0, 255, 100), DX.TRUE);
            }

            // 自機についているときはエネルギー回復
            if (IsDock)
            {
                ++Energy;
                if (MaxEnergy < Energy)
                {
                    Energy = MaxEnergy;
                }

                ++ShotCounter;
                if (ShotCounter > ShotInterval)
                {
                    ShotCounter = 0;

                    // ショットを放つ
                    var sf = new ContainerFactory((GameContainer g) =>
                    {
                        g.AddComponent(new Shot(g, (float)Math.PI * -0.5f, 5.0f , Position.WorldPosition));

                        var b = new BillboardRenderer(g, "dummy.png");
                        b.Scale = 5.0f;
                        g.AddComponent(b);

                        var col = new RectCollider(g, (Collider c) =>
                        {
                            var target = c.Container.GetComponent<EnemyInformation>();
                            if (target != null)
                            {
                                target.Damage(10);
                                GameContainer.Destroy(g);
                            }
                        });
                        col.Width = 10.0f;
                        col.Height = 10.0f;

                        g.AddComponent(col);
                    });

                    sf.Create();
                }
            }
            else
            {
                --Energy;
                Move();
                Lazer.GetComponent<Raypier>().Active = true;

                // 0になれば
                if (Energy <= 0)
                {
                    Dock();
                }
            }
        }