Exemplo n.º 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();
                }
            }
        }
Exemplo n.º 2
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();
            }
        }
Exemplo n.º 3
0
        public override void EnterScene()
        {
            var cf = new ContainerFactory((GameContainer g) =>
            {
                g.AddComponent(new Player(g));
                g.AddComponent(new DisablePlayer(g));
                g.AddComponent(new MeshRenderer(g, "fighter.x"));
                var col = new RectCollider(g, (Collider c) => { return; });
                col.Width = 10.0f;
                col.Height = 10.0f;
                g.AddComponent(col);
            });

            var cameraFactory = new ContainerFactory((GameContainer g) =>
            {
                g.AddComponent(new Camera(g));

            });

            var gc = cf.Create();
            Player player = gc.GetComponent<Player>();

            var fact = new ContainerFactory((GameContainer g) =>
            {
                var a = new RectCollider(g, (Collider c) => { DX.DrawString(0, 0, "HIT", DX.GetColor(255, 255, 255)); });
                a.Width = 10.0f;
                a.Height = 10.0f;
                g.AddComponent(a);
                g.Position.LocalPosition = new Vector3 { x = 50.0f, y = 50.0f, z = 0.0f };
            });
            fact.Create();

            var ec = new GameContainer();
            ec.AddComponent(new EnemyController(ec, player, new ScoreComponent(ec)));

            var camera = cameraFactory.Create().GetComponent<Camera>();
            camera.Position.LocalPosition = new Vector3 { x = 0.0f, y = 0.0f, z = -1000.0f };
            camera.FieldOfView = (float)Math.PI * 0.1f;

            var explosion = new GameContainer();
            explosion.Name = "Explosion";

            var sf = new ContainerFactory((GameContainer g) =>
            {
                var gcom = new Stage(g);
                g.AddComponent(gcom);
                g.AddComponent(new StageTimeline(g, gcom));
                g.AddComponent(new MeshRenderer(g, "hogeStage.x"));
                g.AddComponent(new MusicPlayer(g, "The Ray of Hopes (ver. seeing true sky).wav"));
            });

            sf.Create();
        }
Exemplo n.º 4
0
        /// <summary>
        /// @brief シーン再生直前に呼び出される初期化処理
        /// </summary>
        public override void EnterScene()
        {
            var cf = new ContainerFactory((GameContainer g) =>
            {
                g.AddComponent(new SpriteRenderer(g, "title.png"));
                g.Position.LocalPosition.x = 800;
                g.Position.LocalPosition.y = 450;
            });

            var cameraFactory = new ContainerFactory((GameContainer g) =>
            {
                g.AddComponent(new Camera(g));

            });

            var gc = cf.Create();

            var camera = cameraFactory.Create().GetComponent<Camera>();
            camera.Position.LocalPosition = new Vector3 { x = 0.0f, y = 0.0f, z = -3000.0f };
            camera.FieldOfView = (float)Math.PI * 0.1f;
        }
Exemplo n.º 5
0
        public override void EnterScene()
        {
            var cf = new ContainerFactory((GameContainer g) =>
            {
                g.AddComponent(new Player(g));
                //g.AddComponent(new SpriteRenderer(g, "dummy.png"));
                g.AddComponent(new MeshRenderer(g, "fighter.x"));
            });

            var cameraFactory = new ContainerFactory((GameContainer g) =>
            {
                g.AddComponent(new Camera(g));
            });

            var gc = cf.Create(Root);
            var player = gc.GetComponent<Player>();

            var bitmaker = new ContainerFactory((GameContainer g) =>
            {
                g.AddComponent(new Bit(g));
                g.AddComponent(new BillboardRenderer(g, "dummy.png"));
            });

            bitmaker.Create(gc);
            //player.Position.LocalRotation = new Quaternion(Vector3.AxisX, (float)Math.PI * 0.5f) * new Quaternion(Vector3.AxisZ, (float)Math.PI);

            var camera = cameraFactory.Create(Root).GetComponent<Camera>();
            camera.Position.LocalPosition = new Vector3 { x = 0.0f, y = 1000.0f, z = 0.0f };
            camera.Position.LocalRotation *= new Quaternion(Vector3.AxisX, (float)Math.PI / 2.0f);
            camera.FieldOfView = (float)Math.PI * 0.1f;
        }
Exemplo n.º 6
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();
            }
        }
Exemplo n.º 7
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();
                }
            }
        }