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; }
public static void setInstance(LockonRangeRenderer lr) { instance_ = lr; }