public static void createPool() { pool_ = new EnemyBullet[POOL_MAX]; for (var i = 0; i < POOL_MAX; ++i) { var task = new EnemyBullet(); task.alive_ = false; pool_[i] = task; } pool_index_ = 0; }
public IEnumerator zako2_act() { rigidbody_.setDamper(2f); rigidbody_.setRotateDamper(20f); target_position_.x = MyRandom.Range(-5f, 5f); target_position_.y = MyRandom.Range(-5f, 5f); yield return(null); for (var i = new Utility.WaitForSeconds(2.2f, update_time_); !i.end(update_time_);) { rigidbody_.addForceZ(-160f); rigidbody_.addSpringForceXY(target_position_.x, target_position_.y, 2f); yield return(null); } var sec = MyRandom.Range(3f, 5f); var fired_time = update_time_; var move_force = new Vector3(-target_position_.x, -target_position_.y, 0f); move_force.Normalize(); move_force = Quaternion.Euler(0f, 0f, MyRandom.Range(-45f, 45f)) * move_force * 4f; for (var i = new Utility.WaitForSeconds(sec, update_time_); !i.end(update_time_);) { rigidbody_.addTargetTorque(ref Player.Instance.rigidbody_.transform_.position_, 100f); rigidbody_.addForce(ref move_force); var target = Player.Instance.rigidbody_.transform_.position_; if (update_time_ - fired_time > 0.4f) { EnemyBullet.create(ref rigidbody_.transform_.position_, ref target, 50f /* speed */, update_time_); fired_time = update_time_; } yield return(null); } for (var i = new Utility.WaitForSeconds(4f, update_time_); !i.end(update_time_);) { rigidbody_.addOrientTorque(ref CV.Vector3Back, 100f); rigidbody_.addForceZ(-80f); yield return(null); } destroy(); }
public IEnumerator zako_act() { rigidbody_.setDamper(2f); rigidbody_.setRotateDamper(4f); yield return(null); for (var i = new Utility.WaitForSeconds(0.8f, update_time_); !i.end(update_time_);) { rigidbody_.addSpringTorque(ref Player.Instance.rigidbody_.transform_.position_, 3f); rigidbody_.addSpringForceY(4f /* target_y */, 4f /* ratio */); yield return(null); } WaterSurface.Instance.makeBump(ref rigidbody_.transform_.position_, 1f /* value */, 1f /* size */); for (var i = new Utility.WaitForSeconds(1f, update_time_); !i.end(update_time_);) { rigidbody_.addSpringTorque(ref Player.Instance.rigidbody_.transform_.position_, 3f); rigidbody_.addSpringForceY(4f /* target_y */, 4f /* ratio */); if (MyRandom.Probability(0.1f)) { WaterSplash.Instance.spawn(ref rigidbody_.transform_.position_, ref CV.Vector3Zero, update_time_ - 0.2f); } yield return(null); } for (var i = new Utility.WaitForSeconds(10f, update_time_); !i.end(update_time_);) { var pos = Player.Instance.rigidbody_.transform_.position_; // pos.y -= 1f; rigidbody_.addSpringTorque(ref pos, 8f); rigidbody_.addSpringForceY(4f /* target_y */, 4f /* ratio */); if (MyRandom.Probability(0.04f)) { EnemyBullet.create(ref rigidbody_.transform_.position_, ref rigidbody_.transform_.rotation_, 60f /* speed */, update_time_); } yield return(null); } for (var i = new Utility.WaitForSeconds(3f, update_time_); !i.end(update_time_);) { rigidbody_.addHorizontalStableTorque(8f /* torque_level */); rigidbody_.addRelativeForceZ(80f); yield return(null); } destroy(); }
public IEnumerator zako_act() { rigidbody_.setDamper(2f); rigidbody_.setRotateDamper(2f); target_position_.x = MyRandom.Range(-20f, 20); target_position_.y = MyRandom.Range(-20f, 20); rigidbody_.addForceZ(40f); yield return(null); // for (var i = Utility.WaitForSeconds(10f, update_time_); i.MoveNext();) { for (var i = new Utility.WaitForSeconds(10f, update_time_); !i.end(update_time_);) { rigidbody_.addForceX(target_position_.x - rigidbody_.transform_.position_.x * 2f); rigidbody_.addForceY(target_position_.y - rigidbody_.transform_.position_.y * 2f); rigidbody_.addForceZ(10f); rigidbody_.addTorqueZ(-rigidbody_.velocity_.x * 1f); if (MyRandom.ProbabilityForSecond(1.5f, SystemManager.Instance.getDT())) { var pos = Player.Instance.rigidbody_.transform_.position_; pos.z += MyRandom.Range(-10f, 10f); EnemyBullet.create(ref rigidbody_.transform_.position_, ref pos, 50f /* speed */, update_time_); } if (phase_ == Phase.Dying) { // for (var j = Utility.WaitForSeconds(0.1f, update_time_); j.MoveNext();) { for (var j = new Utility.WaitForSeconds(0.1f, update_time_); j.end(update_time_);) { yield return(null); } break; } yield return(null); } destroy(); }
void Awake() { #if UNITY_PSP2 UnityEngine.PSVita.Diagnostics.enableHUD = true; #endif Application.targetFrameRate = 60; DontDestroyOnLoad(gameObject); stopwatch_ = new System.Diagnostics.Stopwatch(); stopwatch_.Start(); rendering_front_ = 0; Instance.init(); Options.Instance.init(); InputManager.Instance.init(); GameManager.Instance.init(); TaskManager.Instance.init(); MyCollider.createPool(); LockTarget.createPool(); Missile.createPool(); Bullet.createPool(); Enemy.createPool(); EnemyBullet.createPool(); Debris.Instance.init(debris_material_); Spark.Instance.init(spark_material_); Beam.Instance.init(beam_material_); Trail.Instance.init(trail_material_); Explosion.Instance.init(explosion_material_); Hahen.Instance.init(hahen_material_); HUD.Instance.init(); draw_buffer_ = new DrawBuffer[2]; for (int i = 0; i < 2; ++i) { draw_buffer_[i].init(); } manual_reset_event_ = new System.Threading.ManualResetEvent(false); setFPS(DefaultFps); update_frame_ = 0; update_sync_frame_ = 0; update_time_ = 0f; render_frame_ = 0; render_sync_frame_ = 0; pause_ = false; camera_ = GameObject.Find("MainCamera").GetComponent <Camera>(); // Camera.main; ProjectionMatrix = camera_.projectionMatrix; camera_.enabled = false; if (player_prefab_ != null) { player_go_ = Instantiate(player_prefab_) as GameObject; } if (zako_prefab_ != null) { zako_pool_ = new GameObject[ZAKO_MAX]; for (var i = 0; i < ZAKO_MAX; ++i) { zako_pool_[i] = Instantiate(zako_prefab_) as GameObject; zako_pool_[i].SetActive(false); } } uv_scroller_list_ = new UVScroller[8]; // pause menu pausemenu_canvas_go_ = GameObject.Find("Canvas"); if (pausemenu_canvas_go_ != null) { var go = GameObject.Find("FPSValue"); fps_text_ = go.GetComponent <UnityEngine.UI.Text>(); fps_text_.text = "1/" + fps_.ToString(); pausemenu_canvas_go_.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.05f; } 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.25f; } audio_source_explosion_index_ = 0; audio_sources_missile_ = new AudioSource[AUDIOSOURCE_MISSILE_MAX]; for (var i = 0; i < AUDIOSOURCE_MISSILE_MAX; ++i) { audio_sources_missile_[i] = gameObject.AddComponent <AudioSource>(); audio_sources_missile_[i].clip = se_missile_; audio_sources_missile_[i].volume = 0.25f; } audio_source_missile_index_ = 0; audio_sources_lockon_ = new AudioSource[AUDIOSOURCE_LOCKON_MAX]; for (var i = 0; i < AUDIOSOURCE_LOCKON_MAX; ++i) { audio_sources_lockon_[i] = gameObject.AddComponent <AudioSource>(); audio_sources_lockon_[i].clip = se_lockon_; audio_sources_lockon_[i].volume = 0.25f; } audio_source_lockon_index_ = 0; audio_sources_voice_ikuyo_ = gameObject.AddComponent <AudioSource>(); audio_sources_voice_ikuyo_.clip = se_voice_ikuyo_; audio_sources_voice_ikuyo_.volume = 0.75f; audio_sources_voice_uwaa_ = gameObject.AddComponent <AudioSource>(); audio_sources_voice_uwaa_.clip = se_voice_uwaa_; audio_sources_voice_uwaa_.volume = 0.75f; audio_sources_voice_sorosoro_ = gameObject.AddComponent <AudioSource>(); audio_sources_voice_sorosoro_.clip = se_voice_sorosoro_; audio_sources_voice_sorosoro_.volume = 0.75f; audio_sources_voice_ototo_ = gameObject.AddComponent <AudioSource>(); audio_sources_voice_ototo_.clip = se_voice_ototo_; audio_sources_voice_ototo_.volume = 0.75f; audio_sources_voice_yoshi_ = gameObject.AddComponent <AudioSource>(); audio_sources_voice_yoshi_.clip = se_voice_yoshi_; audio_sources_voice_yoshi_.volume = 0.75f; audio_sources_bgm_ = gameObject.AddComponent <AudioSource>(); audio_sources_bgm_.clip = bgm01_; audio_sources_bgm_.volume = 0.5f; audio_sources_bgm_.loop = true; gc_start_count_ = System.GC.CollectionCount(0 /* generation */); }
private void initialize() { #if UNITY_PSP2 UnityEngine.PSVita.Diagnostics.enableHUD = true; #endif DontDestroyOnLoad(gameObject); stopwatch_ = new System.Diagnostics.Stopwatch(); stopwatch_.Start(); rendering_front_ = 0; camera_ = GameObject.Find("MainCamera").GetComponent <Camera>(); // Camera.main; camera_.eventMask = 0; { player_go_ = Instantiate(player_prefab_) as GameObject; player_arm_transform_ = player_go_.transform.Find("fighter_arm"); { var go = new GameObject(); go.name = "LockonRangeRenderer"; go.transform.position = CV.Vector3Zero; go.transform.rotation = CV.QuaternionIdentity; var lr = go.AddComponent <LockonRangeRenderer>(); LockonRangeRenderer.setInstance(lr); go.transform.SetParent(player_go_.transform); go.transform.localPosition = new Vector3(0f, 0.5f, 0f); } { var go = new GameObject(); go.name = "ShieldRenderer"; go.transform.position = Vector3.zero; go.transform.rotation = Quaternion.identity; go.AddComponent <ShieldRenderer>(); go.transform.SetParent(player_go_.transform); go.transform.localPosition = new Vector3(0f, 0f, 0f); } } Options.Instance.init(); InputManager.Instance.init(); GameManager.Instance.init(); TaskManager.Instance.init(); MyCollider.createPool(); LockTarget.createPool(); Missile.createPool(); Bullet.createPool(); Enemy.createPool(); EnemyBullet.createPool(); Shutter.createPool(); Debris.Instance.init(debris_material_); Spark.Instance.init(spark_material_); Beam.Instance.init(beam_material_); Beam2.Instance.init(beam2_material_); Trail.Instance.init(trail_material_); Explosion.Instance.init(explosion_material_); Hahen.Instance.init(hahen_material_); Shockwave.Instance.init(shockwave_material_); // HUD.Instance.init(); LockonRange.Instance.init(lockon_range_material_); LockonRangeRenderer.Instance.init(camera_); Shield.Instance.init(shield_material_); Sight.Instance.init(sight_material_); if (SightRenderer.Instance) { SightRenderer.Instance.init(camera_); } VRSprite.Instance.init(sprites_, vrsprite_material_); if (VRSpriteRenderer.Instance) { VRSpriteRenderer.Instance.init(camera_); } Notice.createPool(); MySprite.Instance.init(sprites_, sprite_material_); MySpriteRenderer.Instance.init(camera_); MyFont.Instance.init(font_, font_material_); MyFontRenderer.Instance.init(camera_); draw_buffer_ = new DrawBuffer[2]; for (int i = 0; i < 2; ++i) { draw_buffer_[i].init(); } manual_reset_event_ = new System.Threading.ManualResetEvent(false); #if UNITY_PS4 setFPS(120); #else setFPS(90); #endif update_frame_ = 0; update_sync_frame_ = 0; update_time_ = 0f; render_frame_ = 0; render_sync_frame_ = 0; camera_holder_transform_ = camera_holder_.transform; ProjectionMatrix = camera_.projectionMatrix; if (zako_prefab_ != null) { zako_pool_ = new GameObject[ZAKO_MAX]; for (var i = 0; i < ZAKO_MAX; ++i) { zako_pool_[i] = Instantiate(zako_prefab_) as GameObject; 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); } } if (shutter_prefab_ != null) { shutter_pool_ = new GameObject[SHUTTER_MAX]; for (var i = 0; i < SHUTTER_MAX; ++i) { shutter_pool_[i] = Instantiate(shutter_prefab_) as GameObject; shutter_pool_[i].SetActive(false); } } uv_scroller_list_ = new UVScroller[8]; // 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.4f; } 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.25f; } audio_source_explosion_index_ = 0; audio_sources_missile_ = new AudioSource[AUDIOSOURCE_MISSILE_MAX]; for (var i = 0; i < AUDIOSOURCE_MISSILE_MAX; ++i) { audio_sources_missile_[i] = gameObject.AddComponent <AudioSource>(); audio_sources_missile_[i].clip = se_missile_; audio_sources_missile_[i].volume = 0.25f; } audio_source_missile_index_ = 0; audio_sources_lockon_ = new AudioSource[AUDIOSOURCE_LOCKON_MAX]; for (var i = 0; i < AUDIOSOURCE_LOCKON_MAX; ++i) { audio_sources_lockon_[i] = gameObject.AddComponent <AudioSource>(); audio_sources_lockon_[i].clip = se_lockon_; audio_sources_lockon_[i].volume = 0.20f; } audio_source_lockon_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.25f; } audio_source_shield_index_ = 0; audio_sources_voice_ikuyo_ = gameObject.AddComponent <AudioSource>(); audio_sources_voice_ikuyo_.clip = se_voice_ikuyo_; audio_sources_voice_ikuyo_.volume = 0.75f; audio_sources_voice_uwaa_ = gameObject.AddComponent <AudioSource>(); audio_sources_voice_uwaa_.clip = se_voice_uwaa_; audio_sources_voice_uwaa_.volume = 0.75f; audio_sources_voice_sorosoro_ = gameObject.AddComponent <AudioSource>(); audio_sources_voice_sorosoro_.clip = se_voice_sorosoro_; audio_sources_voice_sorosoro_.volume = 0.75f; audio_sources_voice_ototo_ = gameObject.AddComponent <AudioSource>(); audio_sources_voice_ototo_.clip = se_voice_ototo_; audio_sources_voice_ototo_.volume = 0.75f; audio_sources_voice_yoshi_ = gameObject.AddComponent <AudioSource>(); audio_sources_voice_yoshi_.clip = se_voice_yoshi_; audio_sources_voice_yoshi_.volume = 0.75f; audio_sources_bgm_ = gameObject.AddComponent <AudioSource>(); audio_sources_bgm_.clip = bgm01_; audio_sources_bgm_.volume = 0.5f; audio_sources_bgm_.loop = true; is_bgm_playing_ = false; gc_start_count_ = System.GC.CollectionCount(0 /* generation */); my_camera_ = MyCamera.create(); player_ = Player.create(); flow_speed_target_ = 0f; flow_speed_ = 0f; }
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 IEnumerator dragon_act() { double charge_start = update_time_; rigidbody_.setDamper(2f); while (dragon_.mode_ == Dragon.Mode.Attack) { // for (var i = new Utility.WaitForSeconds(30f, update_time_); !i.end(update_time_);) { { { var target = Player.Instance.rigidbody_.transform_.position_ + new Vector3(0f, 0f, 20f); limit_target(ref target, 4f); rigidbody_.addTargetTorque(ref target, 50f /* torque_level */, -1f /* max_level */); rigidbody_.addForwardForce(40f); rigidbody_.addLocalTorqueZ(60f); } if (update_time_ - charge_start < 4f) { dragon_.is_charging_ = true; } else { // dragon_.is_charging_ = false; double fired_time = 0; for (var w = new Utility.WaitForSeconds(4f, update_time_); !w.end(update_time_);) { var target = Player.Instance.rigidbody_.transform_.position_; rigidbody_.addTargetTorque(ref target, 50f /* torque_level */, -1f /* max_level */); if (update_time_ - fired_time > 0.2f) { var muzzle_pos = rigidbody_.transform_.transformPosition(ref MUZZLE_OFFSET); SystemManager.Instance.registSound(DrawBuffer.SE.Missile); EnemyBullet.create(ref muzzle_pos, ref rigidbody_.transform_.rotation_, 50f /* speed */, 2f /* width */, 20f /* length */, update_time_); fired_time = update_time_; } yield return(null); } charge_start = update_time_; } yield return(null); } yield return(null); } for (var i = new Utility.WaitForSeconds(2f, update_time_); !i.end(update_time_);) { rigidbody_.addOrientTorque(ref CV.Vector3Forward, 50f /* torque_level */); rigidbody_.addLocalTorqueZ(60f); rigidbody_.addSpringForceZ(-9f, 0.5f /* ratio */); yield return(null); } rigidbody_.setDamper(8f); { double back_and_force_time = update_time_ + 5f; double fire_time = update_time_ + 1f; while (dragon_.mode_ == Dragon.Mode.Chase) { rigidbody_.addOrientTorque(ref CV.Vector3Forward, 50f /* torque_level */); float phase = Mathf.Repeat((float)update_time_ * 1f, Mathf.PI * 2f); rigidbody_.addLocalTorqueZ(-7f); rigidbody_.addSpringForceXY(Mathf.Cos(phase) * 8f, Mathf.Sin(phase) * 8f, 8f /* ratio */); float target_z = -5f; if (update_time_ - back_and_force_time > 0f) { float p = -40f + Mathf.PerlinNoise(Mathf.Repeat((float)update_time_ * 0.1f, 1f), 0f) * 120f; target_z += p; } rigidbody_.addSpringForceZ(target_z, 20f /* ratio */); if (update_time_ - fire_time > 0f) { if (Player.Instance.rigidbody_.transform_.position_.z > rigidbody_.transform_.position_.z) { SystemManager.Instance.registSound(DrawBuffer.SE.Missile); var muzzle_pos = rigidbody_.transform_.transformPosition(ref MUZZLE_OFFSET); EnemyBullet.create(ref muzzle_pos, ref CV.QuaternionIdentity, 50f /* speed */, 2f /* width */, 20f /* length */, update_time_); } fire_time = update_time_ + 0.2f + Mathf.PerlinNoise(Mathf.Repeat((float)update_time_, 1f), 0f) * 0.5f; } dragon_.addTubeTorque(1f /* power */); yield return(null); } } while (dragon_.mode_ == Dragon.Mode.Farewell) { rigidbody_.addForceZ(-100f); yield return(null); } { for (var w = new Utility.WaitForSeconds(2f, update_time_); !w.end(update_time_);) { yield return(null); } var pos = Player.Instance.rigidbody_.transform_.position_ + new Vector3(0f, 20f, 10f); var rot = Quaternion.Euler(90f, 0f, 0f); reset(ref pos, ref rot); yield return(null); for (var w = new Utility.WaitForSeconds(0.5f, update_time_); !w.end(update_time_);) { rigidbody_.addForwardForce(100f /* force */); rigidbody_.addLocalTorqueZ(10f); yield return(null); } SystemManager.Instance.registBgm(DrawBuffer.BGM.Stop); SystemManager.Instance.setBulletTime(true); for (var w = new Utility.WaitForSeconds(0.5f, update_time_); !w.end(update_time_);) { rigidbody_.addForwardForce(100f /* force */); rigidbody_.addLocalTorqueZ(10f); yield return(null); } for (var w = new Utility.WaitForSeconds(3f, update_time_); !w.end(update_time_);) { var target = new Vector3(0f, 0f, 15f + Player.Instance.rigidbody_.transform_.position_.z); rigidbody_.addTargetTorque(ref target, 25f /* torque_level */, -1f /* max_level */); rigidbody_.addLocalTorqueZ(-40f); rigidbody_.addForwardForce(200f /* force */); yield return(null); } SystemManager.Instance.setBulletTime(false); for (var w = new Utility.WaitForSeconds(30f, update_time_); !w.end(update_time_);) { rigidbody_.addForwardForce(100f /* force */); rigidbody_.addForceZ(-300f /* force */); yield return(null); } } for (;;) { yield return(null); } }