public override void renderUpdate(int front, CameraBase camra, ref DrawBuffer draw_buffer) { var step = 32f; var ratio = 1f; var x = 80f; int v = (int)(value_ * 8f); for (var i = 0; i < 8; ++i) { MySprite.Kind kind; float y; if (i < 4) { kind = v <= i ? MySprite.Kind.GaugeB_S : MySprite.Kind.GaugeR_S; step = 16f; y = -290f; } else if (i < 7) { kind = v <= i ? MySprite.Kind.GaugeB_M : MySprite.Kind.GaugeR_M; step = 24f; y = -288f; } else { kind = v <= i ? MySprite.Kind.GaugeB_L : MySprite.Kind.GaugeR_L; step = 34f; y = -280f; } x += step; MySprite.Instance.put(front, -x, y, ratio, kind, MySprite.Type.Full); MySprite.Instance.put(front, x, y, ratio, kind, MySprite.Type.Full, true /* reverse */); } }
public void renderUpdate(int front, CameraBase camera, ref DrawBuffer draw_buffer) { for (var it = first_; it != null; it = it.next_) { it.renderUpdate(front, camera, ref draw_buffer); } }
public override void renderUpdate(int front, CameraBase camera, ref DrawBuffer draw_buffer) { // const float LENGTH = 2.5f; // var tail = rigidbody_.transform_.position_ - rigidbody_.velocity_.normalized * LENGTH; Beam.Instance.renderUpdate(front, beam_id_, ref rigidbody_.transform_.position_, ref prev_position_); }
public override void renderUpdate(int front, CameraBase dummy, ref DrawBuffer draw_buffer) { if (active_) { draw_buffer.registCamera(ref transform_); var view_matrix = transform_.getTRS(); var projection_matrix = SystemManager.Instance.ProjectionMatrix; screen_matrix_ = projection_matrix * view_matrix.inverse; } }
public override void renderUpdate(int front, CameraBase dummy, ref DrawBuffer draw_buffer) { var offset = new Vector3(0f, 0f, 15f); var pos = rigidbody_.transform_.position_ + rigidbody_.transform_.rotation_ * offset; pos -= (rigidbody_.transform_.rotation_ * offset_rotation_) * offset; var rot = rigidbody_.transform_.rotation_ * offset_rotation_; applyTransform(ref pos, ref rot); base.renderUpdate(front, dummy, ref draw_buffer); }
public override void renderUpdate(int front, CameraBase dummy, ref DrawBuffer draw_buffer) { if (active_) { draw_buffer.registCamera(ref rigidbody_.transform_); var view_matrix = Matrix4x4.TRS(rigidbody_.transform_.position_, rigidbody_.transform_.rotation_, CV.Vector3One); var projection_matrix = SystemManager.Instance.ProjectionMatrix; screen_matrix_ = projection_matrix * view_matrix.inverse; } }
public override void renderUpdate(int front, CameraBase camera, ref DrawBuffer draw_buffer) { const float LENGTH = 20f; var diff = rigidbody_.transform_.position_ - fired_position_; var length = diff.magnitude; Vector3 tail; if (length < LENGTH) { tail = fired_position_; } else { tail = rigidbody_.transform_.position_ - rigidbody_.velocity_.normalized * LENGTH; } Beam2.Instance.renderUpdate(front, beam_id_, ref rigidbody_.transform_.position_, ref tail); }
public void end(int front, CameraBase camera) { const float SIZE = 16f; float size = SIZE; switch (phase_) { case 0: cnt_ = MyRandom.Range(300, 400); cnt1_ = 0; ++phase_; break; case 1: --cnt_; if (cnt_ < 0) { cnt_ = 16; size = 0f; ++phase_; } break; case 2: size = (float)(16 - cnt_) / 16f * SIZE; --cnt_; if (cnt_ < 0) { cnt_ = 12; ++phase_; } break; case 3: --cnt_; if (cnt_ < 0) { cnt_ = 4; ++phase_; } break; case 4: --cnt_; if (cnt_ < 0) { cnt_ = 12; ++cnt1_; if (cnt1_ > 8) { phase_ = 0; } else { --phase_; } } break; } if (phase_ != 2 && phase_ != 3) { return; } for (var i = 0; i < regist_index_; ++i) { var spos = (camera != null ? camera.getScreenPoint(ref positions_[i]) : positions_[i]); float size0 = spos.z > 1f ? size : 0f; vertices_[front][i * 6 + 0].x = spos.x + size0; vertices_[front][i * 6 + 0].y = spos.y; vertices_[front][i * 6 + 1].x = spos.x; vertices_[front][i * 6 + 1].y = spos.y + size0; vertices_[front][i * 6 + 2].x = spos.x - size0; vertices_[front][i * 6 + 2].y = spos.y; vertices_[front][i * 6 + 3].x = spos.x; vertices_[front][i * 6 + 3].y = spos.y - size0; vertices_[front][i * 6 + 4].x = spos.x + size0 * 2f; vertices_[front][i * 6 + 4].y = spos.y - size0 * 3f; vertices_[front][i * 6 + 5].x = spos.x + size0 * 4f; vertices_[front][i * 6 + 5].y = spos.y - size0 * 3f; } }
public abstract void renderUpdate(int front, CameraBase camera, ref DrawBuffer draw_buffer);
public override void renderUpdate(int front, CameraBase camra, ref DrawBuffer draw_buffer) { muscle_motion_.renderUpdate(ref draw_buffer, DrawBuffer.Type.MuscleMotionPlayer); }
public override void renderUpdate(int front, CameraBase dummy, ref DrawBuffer draw_buffer) { applyTransform(ref rigidbody_.transform_.position_, ref rigidbody_.transform_.rotation_); }
public void setup(CameraBase prev_camera) { rigidbody_.setPositionAndRotation(ref prev_camera.transform_); }
private void main_loop() { PerformanceMeter.Instance.beginUpdate(); int updating_front = get_front(); // fetch Controller.Instance.fetch(updating_front, update_time_); var controller = Controller.Instance.getLatest(); if (!pause_ && controller.isPauseButtonDown()) { pause_ = true; } #if UNITY_EDITOR else if (pause_ && controller.isPauseButtonDown()) { pause_ = false; } #endif // update if (!pause_) { int loop_num = 1; if (PerformanceMeter.Instance.wasSlowLoop()) { loop_num = 2; } for (var loop = 0; loop < loop_num; ++loop) { GameManager.Instance.update(dt_, update_time_); TaskManager.Instance.update(dt_, update_time_); MyCollider.calculate(); WaterSplash.Instance.update(update_time_); ++update_frame_; update_time_ += dt_; } } PerformanceMeter.Instance.endUpdate(); PerformanceMeter.Instance.beginRenderUpdate(); CameraBase current_camera = spectator_mode_ ? spectator_camera_ : my_camera_; // begin MySprite.Instance.begin(); MyFont.Instance.begin(); Spark.Instance.begin(); Beam.Instance.begin(updating_front); Beam2.Instance.begin(updating_front); Explosion.Instance.begin(); Hahen.Instance.begin(); Shield.Instance.begin(); Sight.Instance.begin(updating_front); // renderUpdate draw_buffer_[updating_front].beginRender(); WaterSurface.Instance.renderUpdate(updating_front); WaterSplash.Instance.renderUpdate(updating_front); TaskManager.Instance.renderUpdate(updating_front, current_camera, ref draw_buffer_[updating_front]); draw_buffer_[updating_front].endRender(); // performance meter #if UTJ_MULTI_THREADED bool multi_threading = true; #else bool multi_threading = false; #endif PerformanceMeter.Instance.drawMeters(updating_front, multi_threading); // end Sight.Instance.end(updating_front, current_camera); Shield.Instance.end(updating_front); Hahen.Instance.end(updating_front); Explosion.Instance.end(updating_front); Beam2.Instance.end(); Beam.Instance.end(); Spark.Instance.end(updating_front); MyFont.Instance.end(updating_front); MySprite.Instance.end(updating_front); PerformanceMeter.Instance.endRenderUpdate(); }
private IEnumerator initialize() { camera_final_ = camera_final_holder_.GetComponent <Camera>(); camera_final_.enabled = false; UnityPluginIF.Load("UnityPlugin"); Application.targetFrameRate = (int)RENDER_FPS; DontDestroyOnLoad(gameObject); stopwatch_ = new System.Diagnostics.Stopwatch(); stopwatch_.Start(); rendering_front_ = 0; #if UTJ_MULTI_THREADED manual_reset_event_ = new System.Threading.ManualResetEvent(false); update_sync_frame_ = 0; #endif setFPS(DefaultFps); update_frame_ = 0; update_time_ = 0f; render_frame_ = 0; render_sync_frame_ = 0; pause_ = false; spectator_mode_ = auto_; canvas_.SetActive(false); camera_ = camera_holder_.GetComponent <Camera>(); ProjectionMatrix = camera_.projectionMatrix; BoxingPool.init(); InputManager.Instance.init(); Controller.Instance.init(auto_); TaskManager.Instance.init(); MyCollider.createPool(); Bullet.createPool(); EnemyBullet.createPool(); EnemyLaser.createPool(); Enemy.createPool(); WaterSurface.Instance.init(water_surface_input_material_, water_surface_distortion_, water_surface_line_render_); WaterSurfaceRenderer.Instance.init(camera_.transform); Spark.Instance.init(spark_material_); Beam.Instance.init(beam_material_); BeamRenderer.Instance.init(Beam.Instance); Beam2.Instance.init(beam2_material_); Beam2Renderer.Instance.init(Beam2.Instance); WaterSplash.Instance.init(water_splash_material_, WaterSurfaceRenderer.Instance.getReflectionTexture()); WaterSplashRenderer.Instance.init(WaterSplash.Instance); AuraEffect.Instance.init(); Explosion.Instance.init(explosion_material_); ExplosionRenderer.Instance.init(Explosion.Instance); Hahen.Instance.init(hahen_material_); HahenRenderer.Instance.init(Hahen.Instance); Shield.Instance.init(shield_material_); ShieldRenderer.Instance.init(Shield.Instance); Debris.Instance.init(debris_material_); Dust.Instance.init(dust_material_); LightEnvironmentController.Instance.init(); Sight.Instance.init(sight_material_); SightRenderer.Instance.init(Sight.Instance); MySprite.Instance.init(sprites_, sprite_material_); MySpriteRenderer.Instance.init(camera_); MyFont.Instance.init(font_, font_material_); MyFontRenderer.Instance.init(); GaugeJump.Create(); PerformanceMeter.Instance.init(); draw_buffer_ = new DrawBuffer[2]; for (int i = 0; i < 2; ++i) { draw_buffer_[i].init(); } yield return(Player.Instance.initialize()); my_camera_ = MyCamera.create(); spectator_camera_ = SpectatorCamera.create(); set_camera(spectator_mode_); if (player_prefab_ != null) { GameObject go = Instantiate(player_prefab_); // player_renderer_ = go.GetComponent<PlayerRenderer>(); muscle_motion_renderer_player_ = go.GetComponent <MuscleMotionRenderer>(); muscle_motion_renderer_player_.init(); } if (enemy_zako_prefab_ != null) { enemy_zako_pool_ = new GameObject[ENEMY_ZAKO_MAX]; for (var i = 0; i < ENEMY_ZAKO_MAX; ++i) { enemy_zako_pool_[i] = Instantiate(enemy_zako_prefab_) as GameObject; enemy_zako_pool_[i].SetActive(false); } } if (dragon_head_prefab_ != null) { dragon_head_pool_ = new GameObject[DRAGON_HEAD_MAX]; for (var i = 0; i < DRAGON_HEAD_MAX; ++i) { dragon_head_pool_[i] = Instantiate(dragon_head_prefab_) as GameObject; dragon_head_pool_[i].SetActive(false); } } if (dragon_body_prefab_ != null) { dragon_body_pool_ = new GameObject[DRAGON_BODY_MAX]; for (var i = 0; i < DRAGON_BODY_MAX; ++i) { dragon_body_pool_[i] = Instantiate(dragon_body_prefab_) as GameObject; dragon_body_pool_[i].SetActive(false); } } if (dragon_tail_prefab_ != null) { dragon_tail_pool_ = new GameObject[DRAGON_TAIL_MAX]; for (var i = 0; i < DRAGON_TAIL_MAX; ++i) { dragon_tail_pool_[i] = Instantiate(dragon_tail_prefab_) as GameObject; dragon_tail_pool_[i].SetActive(false); } } // audio audio_sources_bullet_ = new AudioSource[AUDIOSOURCE_BULLET_MAX]; for (var i = 0; i < AUDIOSOURCE_BULLET_MAX; ++i) { audio_sources_bullet_[i] = gameObject.AddComponent <AudioSource>(); audio_sources_bullet_[i].clip = se_bullet_; audio_sources_bullet_[i].volume = 0.04f; } audio_source_bullet_index_ = 0; 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.025f; } 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; audio_sources_shield_ = new AudioSource[AUDIOSOURCE_SHIELD_MAX]; for (var i = 0; i < AUDIOSOURCE_SHIELD_MAX; ++i) { audio_sources_shield_[i] = gameObject.AddComponent <AudioSource>(); audio_sources_shield_[i].clip = se_shield_; audio_sources_shield_[i].volume = 0.020f; } audio_source_shield_index_ = 0; audio_sources_shield_ = new AudioSource[AUDIOSOURCE_SHIELD_MAX]; for (var i = 0; i < AUDIOSOURCE_SHIELD_MAX; ++i) { audio_sources_shield_[i] = gameObject.AddComponent <AudioSource>(); audio_sources_shield_[i].clip = se_shield_; audio_sources_shield_[i].volume = 0.025f; } audio_source_shield_index_ = 0; audio_sources_bgm_ = gameObject.AddComponent <AudioSource>(); audio_sources_bgm_.clip = bgm01_; audio_sources_bgm_.volume = 0.05f; audio_sources_bgm_.loop = true; is_bgm_playing_ = false; GameManager.Instance.init(); #if UTJ_MULTI_THREADED update_thread_ = new Thread(thread_entry); update_thread_.Priority = System.Threading.ThreadPriority.Highest; update_thread_.Start(); #endif #if UNITY_PS4 || UNITY_EDITOR int rw = 1920; int rh = 1080; #elif UNITY_PSP2 int rw = 480; int rh = 272; #else int rw = 568; int rh = 320; #endif render_texture_ = new RenderTexture(rw, rh, 24 /* depth */, RenderTextureFormat.ARGB32); render_texture_.Create(); camera_.targetTexture = render_texture_; final_material_.mainTexture = render_texture_; initialized_ = true; camera_final_.enabled = true; }
public override void renderUpdate(int front, CameraBase camera, ref DrawBuffer draw_buffer) { on_render_update_(front, ref draw_buffer); }
void main_loop() { PerformanceMeter.Instance.beginUpdate(); int updating_front = get_front(); // fetch Controller.Instance.fetch(update_time_); var controller = Controller.Instance.getLatest(); // update float dt = dt_; if (pause_) { dt = 0f; } spectator_camera_.rotateOffsetRotation(-controller.flick_y_, controller.flick_x_); UnityEngine.Profiling.Profiler.BeginSample("Task update"); GameManager.Instance.update(dt, update_time_); TaskManager.Instance.update(dt, update_time_); UnityEngine.Profiling.Profiler.EndSample(); ++update_frame_; update_time_ += dt; UnityEngine.Profiling.Profiler.BeginSample("MissileManager.update"); MissileManager.Instance.update(dt, update_time_); UnityEngine.Profiling.Profiler.EndSample(); PerformanceMeter.Instance.endUpdate(); PerformanceMeter.Instance.beginRenderUpdate(); CameraBase current_camera = spectator_mode_ ? spectator_camera_ as CameraBase : debug_camera_ as CameraBase; // begin UnityEngine.Profiling.Profiler.BeginSample("renderUpdate_begin"); MySprite.Instance.begin(); MyFont.Instance.begin(); Spark.Instance.begin(); UnityEngine.Profiling.Profiler.EndSample(); // renderUpdate UnityEngine.Profiling.Profiler.BeginSample("renderUpdate"); draw_buffer_[updating_front].beginRender(); TaskManager.Instance.renderUpdate(updating_front, current_camera, ref draw_buffer_[updating_front]); draw_buffer_[updating_front].endRender(); UnityEngine.Profiling.Profiler.EndSample(); // performance meter if (meter_draw_) { PerformanceMeter.Instance.drawMeters(updating_front); } // end UnityEngine.Profiling.Profiler.BeginSample("renderUpdate_end"); Spark.Instance.end(); MyFont.Instance.end(); MySprite.Instance.end(); UnityEngine.Profiling.Profiler.EndSample(); PerformanceMeter.Instance.endRenderUpdate(); }