Exemplo n.º 1
0
        private IEnumerator act()
        {
            game_phase_ = GamePhase.Title;
            Player.Instance.setPhaseTitle();
            Player.Instance.setPositionXY(0f, -27f);
            SystemManager.Instance.registBgm(DrawBuffer.BGM.Stop);
            SystemManager.Instance.registMotion(DrawBuffer.Motion.Play);
            SystemManager.Instance.setFlowSpeed(0f);
            SystemManager.Instance.setSubjective(true);

            for (var w = new Utility.WaitForSeconds(4f, update_time_); !w.end(update_time_);)
            {
                yield return(null);
            }
            Notice notice;
            {
                notice = Notice.create(-400f, 400f,
                                       MySprite.Kind.GamePadPress,
                                       MySprite.Type.Full,
                                       false /* blink */);
            }
            var leave_time_start = update_time_;

            while (game_phase_ == GamePhase.Title)
            {
                bool exit_title   = false;
                var  elapsed_time = update_time_ - leave_time_start;
                if (InputManager.Instance.getButton(InputManager.Button.Fire) > 0)
                {
                    exit_title = true;
                    replay_manager_.startRecording(update_time_);
                    replay_mode_ = false;
                }
                else
                {
                    if (replay_manager_.hasRecorded())
                    {
                        bool start_replay = false;
                        if (replay_mode_)
                        {
                            if (elapsed_time > 1f)
                            {
                                start_replay = true;
                            }
                        }
                        else
                        {
                            if (elapsed_time > 30f)
                            {
                                start_replay = true;
                                replay_mode_ = true;
                            }
                        }
                        if (start_replay)
                        {
                            exit_title = true;
                            SystemManager.Instance.setSubjective(false);
                            replay_manager_.startPlaying(update_time_, Player.Instance);
                        }
                    }
                }
                if (exit_title)
                {
                    game_phase_ = GamePhase.Game;
                    SystemManager.Instance.registSound(DrawBuffer.SE.Missile);
                    SystemManager.Instance.registMotion(DrawBuffer.Motion.GoodLuck);
                }
                yield return(null);
            }
            notice.destroy();
            MyRandom.setSeed(123456789u);

            for (var w = new Utility.WaitForSeconds(1.5f, update_time_); !w.end(update_time_);)
            {
                yield return(null);
            }
            Player.Instance.setPhaseStart();
            SystemManager.Instance.registBgm(DrawBuffer.BGM.Battle);
            for (var w = new Utility.WaitForSeconds(4f, update_time_); !w.end(update_time_);)
            {
                yield return(null);
            }
            Notice.create(0f, 0f,
                          update_time_ + 3f,
                          MySprite.Kind.GamePadPress,
                          MySprite.Type.Full,
                          true /* blink */);
            for (var w = new Utility.WaitForSeconds(1f, update_time_); !w.end(update_time_);)
            {
                yield return(null);
            }

            Player.Instance.setPhaseBattle();
            SystemManager.Instance.setFlowSpeed(-100f);
            while (TubeScroller.Instance.getDistance() < 100f)
            {
                yield return(null);
            }

            for (var j = 0; j < 4; ++j)
            {
                for (var w = new Utility.WaitForSeconds(2f, update_time_); !w.end(update_time_);)
                {
                    yield return(null);
                }
                for (var i = 0; i < 4; ++i)
                {
                    for (var w = new Utility.WaitForSeconds(0.5f, update_time_); !w.end(update_time_);)
                    {
                        yield return(null);
                    }
                    Enemy.create(Enemy.Type.Zako2);
                }

                if (j == 1)
                {
                    Notice.create(-200f, 200f,
                                  update_time_ + 3f,
                                  MySprite.Kind.GamePadRelease,
                                  MySprite.Type.Full,
                                  true /* blink */);
                }
            }

            while (TubeScroller.Instance.getDistance() < 2400f)
            {
                yield return(null);
            }

            Enemy dragon = Enemy.create(Enemy.Type.Dragon);

            SystemManager.Instance.setFlowSpeed(-10f);

            while (TubeScroller.Instance.getDistance() < 2800f)
            {
                for (var w = new Utility.WaitForSeconds(5f, update_time_); !w.end(update_time_);)
                {
                    yield return(null);
                }
                for (var j = new Utility.WaitForSeconds(2f, update_time_); !j.end(update_time_);)
                {
                    yield return(null);

                    Enemy.create(Enemy.Type.Zako2);
                    for (var w = new Utility.WaitForSeconds(0.25f, update_time_); !w.end(update_time_);)
                    {
                        yield return(null);
                    }
                }
                yield return(null);
            }

            float flow_speed = 150f;

            SystemManager.Instance.setFlowSpeed(-150f);
            dragon.setMode(Dragon.Mode.Chase);

            for (var i = 0; i < 4; ++i)
            {
                for (var v = new Utility.WaitForSeconds(3f, update_time_); !v.end(update_time_);)
                {
                    Enemy.create(Enemy.Type.Zako2);
                    for (var w = new Utility.WaitForSeconds(0.5f, update_time_); !w.end(update_time_);)
                    {
                        yield return(null);
                    }
                }
                for (var w = new Utility.WaitForSeconds(2f, update_time_); !w.end(update_time_);)
                {
                    yield return(null);
                }
            }

            for (var w = new Utility.WaitForSeconds(2f, update_time_); !w.end(update_time_);)
            {
                yield return(null);
            }
            dragon.setMode(Dragon.Mode.Farewell);
            for (var i = 0; i < 16; ++i)
            {
                float rot = 30f * i;
                Shutter.create(rot, flow_speed, update_time_);
                Shutter.create(rot + 180f, flow_speed, update_time_);
                for (var w = new Utility.WaitForSeconds(1f, update_time_); !w.end(update_time_);)
                {
                    yield return(null);
                }
            }
            while (TubeScroller.Instance.getDistance() < 9400f)
            {
                yield return(null);
            }

            dragon.setMode(Dragon.Mode.LastAttack);
            for (var w = new Utility.WaitForSeconds(11f, update_time_); !w.end(update_time_);)
            {
                yield return(null);
            }
            Notice.create(0f, 0f,
                          update_time_ + 6f,
                          MySprite.Kind.Logo,
                          MySprite.Type.Full,
                          false);
            for (var w = new Utility.WaitForSeconds(5f, update_time_); !w.end(update_time_);)
            {
                yield return(null);
            }

            SystemManager.Instance.restart();
        }
Exemplo n.º 2
0
        void initialize()
        {
            MyRandom.setSeed(12345L);
            camera_final_         = GameObject.Find("FinalCamera").GetComponent <Camera>();
            camera_final_.enabled = false;
            if ((float)Screen.width / (float)Screen.height < 16f / 9f)
            {
                var size = camera_final_.orthographicSize * ((16f / 9f) * ((float)Screen.height / (float)Screen.width));
                camera_final_.orthographicSize = size;
            }
            meter_draw_ = true;

            Application.targetFrameRate = (int)RENDER_FPS; // necessary for iOS because the default is 30fps.
            // QualitySettings.vSyncCount = 1;

            stopwatch_ = new System.Diagnostics.Stopwatch();
            stopwatch_.Start();
            rendering_front_ = 0;

            setFPS(DefaultFps);
            update_frame_      = 0;
            update_time_       = 100.0; // ゼロクリア状態を過去のものにするため増やしておく
            render_frame_      = 0;
            render_sync_frame_ = 0;
            pause_             = false;
            spectator_mode_    = true;

            camera_          = GameObject.Find("Main Camera").GetComponent <Camera>();
            ProjectionMatrix = camera_.projectionMatrix;

            MissileManager.Instance.initialize(camera_);
            InputManager.Instance.init();
            Controller.Instance.init(false /* auto */);
            TaskManager.Instance.init();
            Fighter.createPool();
            Spark.Instance.init(spark_material_);
            Debris.Instance.init(debris_material_);
            MySprite.Instance.init(sprites_, sprite_material_);
            MySpriteRenderer.Instance.init(camera_);
            MyFont.Instance.init(font_, font_material_);
            MyFontRenderer.Instance.init();

            PerformanceMeter.Instance.init();

            draw_buffer_ = new DrawBuffer[2];
            for (int i = 0; i < 2; ++i)
            {
                draw_buffer_[i].init();
            }

            debug_camera_     = DebugCamera.create();
            spectator_camera_ = SpectatorCamera.create();
            set_camera();

            // audio
            audio_sources_explosion_ = new AudioSource[AUDIOSOURCE_EXPLOSION_MAX];
            for (var i = 0; i < AUDIOSOURCE_EXPLOSION_MAX; ++i)
            {
                audio_sources_explosion_[i]        = gameObject.AddComponent <AudioSource>();
                audio_sources_explosion_[i].clip   = se_explosion_;
                audio_sources_explosion_[i].volume = 0.01f;
                audio_sources_explosion_[i].pitch  = 0.25f;
            }
            audio_source_explosion_index_ = 0;
            audio_sources_laser_          = new AudioSource[AUDIOSOURCE_LASER_MAX];
            for (var i = 0; i < AUDIOSOURCE_LASER_MAX; ++i)
            {
                audio_sources_laser_[i]        = gameObject.AddComponent <AudioSource>();
                audio_sources_laser_[i].clip   = se_laser_;
                audio_sources_laser_[i].volume = 0.025f;
            }
            audio_source_laser_index_ = 0;

            GameManager.Instance.init(debug_mode_);

#if UNITY_PS4 || UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
            int rw = 1920;
            int rh = 1080;
#else
            int rw = 1024;
            int rh = 576;
#endif
            render_texture_ = new RenderTexture(rw, rh, 24 /* depth */, RenderTextureFormat.ARGB32);
            render_texture_.Create();
            camera_.targetTexture       = render_texture_;
            final_material_.mainTexture = render_texture_;
            alpha_matrices_             = new Matrix4x4[ALPHA_MAX];
            frustum_planes_             = new Vector4[6];

            initialized_          = true;
            camera_final_.enabled = true;
        }