Exemple #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();
                }
            }
        }
Exemple #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;
        }
Exemple #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();
            }
        }
Exemple #4
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();
        }
Exemple #5
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();
            }
        }
        public override GameContainer Create()
        {
            var gc = new GameContainer();
            gc.AddComponent(new EnemyInformation(gc, BehindAppearEnemy.MaxLife, SC));
            gc.AddComponent(new BehindAppearEnemy(gc, From, To));

            var re = new RetreatEnemy(gc, Speed);
            re.Active = false;
            gc.AddComponent(re);

            var rc = new RectCollider(gc, (Collider c) =>
            {
                DX.DrawString(0, 150, "Enemy Hit", DX.GetColor(255, 255, 255));
            });
            rc.Active = false;
            rc.Width = 50.0f;
            rc.Height = 50.0f;
            gc.AddComponent(rc);

            gc.AddComponent(new MeshRenderer(gc, "fighter.x"));

            gc.Position.LocalRotation = new Quaternion(Vector3.AxisX, (float)Math.PI * 0.5f);

            //var vs = new FanShot(gc, (float)Math.PI * 0.5f, From, PlayerPosition);
            //vs.Magazine = 7;
            //var vs = new VerticalShot(gc, 0.5f, From, PlayerPosition);

            var vs = new CircleShot(gc, 0.5f, From, PlayerPosition);
            vs.Magazine = 36;

            vs.Speed = 5.0f;
            vs.Count = 60;
            vs.SpaceanInterval = 60;
            vs.AimFlag = false;

            gc.AddComponent(vs);
            return gc;
        }
        public override GameContainer Create()
        {
            var gc = new GameContainer();
            var iae = new InfrontAppearEnemy(gc, To, new Vector3 { x = To.x + 500.0f * (Dir == Direction.LEFT ? -1 : 1), y = 500.0f, z = 0.0f });
            var se = new StayEnemy(gc, StayTime);
            var de = new DisappearEnemy(gc, new Vector3 { x = To.x + 500.0f * (Dir == Direction.LEFT ? 1 : -1), y = 500.0f, z = 0.0f }, 0.3f);
            gc.AddComponent(iae);
            gc.AddComponent(se);
            gc.AddComponent(de);
            gc.AddComponent(new EnemyInformation(gc, BehindAppearEnemy.MaxLife, SC));
            gc.AddComponent(new MeshRenderer(gc, "fighter.x"));

            var col = new RectCollider(gc, (Collider c) =>
            {

            });
            col.Width = 50.0f;
            col.Height = 50.0f;
            gc.AddComponent(col);
            var vs = new FanShot(gc, (float)Math.PI * 0.5f, To, PlayerPosition);
            vs.Magazine = 7;
            //var vs = new VerticalShot(gc, 0.5f, From, PlayerPosition);

            //var vs = new CircleShot(gc, 0.5f, From, PlayerPosition);
            //vs.Magazine = 36;

            vs.Speed = 5.0f;
            vs.Count = 60;
            vs.SpaceanInterval = 60;
            vs.AimFlag = false;
            gc.Position.LocalRotation = new Quaternion(Vector3.AxisX, (float)Math.PI * 0.5f);
            gc.AddComponent(vs);
            return gc;
        }
 /// <summary>
 /// @brief 衝突処理
 /// </summary>
 /// <param name="target">衝突処理対象</param>
 /// <returns>衝突していればtrue</returns>
 internal override bool IsCollision(RectCollider target)
 {
     var s = BoundingBox;
     var t = target.BoundingBox;
     return s.Left < t.Right && s.Right > t.Left && s.Top < t.Bottom && s.Bottom > t.Top;
 }
 /// <summary>
 /// @brief 衝突処理
 /// </summary>
 /// <param name="target">衝突処理対象</param>
 /// <returns>衝突していればtrue</returns>
 internal abstract bool IsCollision(RectCollider target);
Exemple #10
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();
                }
            }
        }