diff --git a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity index e7eabce..e03279e 100644 --- a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity +++ b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity @@ -865,8 +865,8 @@ MonoBehaviour: m_EditorClassIdentifier: img: {fileID: 2829506254029656376, guid: 8bbc036a3be21954681613cbe4f0e9a8, type: 3} canvas: {fileID: 1191269362} - VisualizeTouches: 1 - frame_gap: 10 + VisualizeTouches: 0 + frame_gap: 30 delta_threshold: 100 snow_size: 256 img_fade_speed: 0.02 diff --git a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/StatManager.cs b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/StatManager.cs index 71ccae6..068a2ae 100644 --- a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/StatManager.cs +++ b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/StatManager.cs @@ -37,41 +37,29 @@ public class StatManager : MonoBehaviour loop_count = 0; h_lerp_val = 0f; s_lerp_val = 1f; - m_timer = h_total_time; + // m_timer = h_total_time; + m_timer = 0f; } void Update() { - trigger_time = i_total_time * loop_to_trigger + h_total_time; + trigger_time = i_total_time * loop_to_trigger; + //if(h_player.IsPlaying == falss) m_timer += Time.deltaTime; - Debug.Log(m_timer); + //Debug.Log(m_timer); //if(h_player.IsPlaying == false){ - if (true) - { //if (idle_player.Frame == idle_player.TotalNumFrames) //{ // loop_count += 1; //Debug.Log(loop_count); //} //if (loop_count >= loop_to_trigger) - if (m_timer > trigger_time) - { - aud = gameObject.AddComponent(); - aud.loop = false; - aud.playOnAwake = false; - aud.clip = horse_clip; - aud.Play(); - m_timer = 0f; - Debug.Log("horse fade in"); - h_player.Play(); - StartCoroutine("h_fade_in"); - loop_count = 0; - } - } + - if (h_player.IsPlaying) - { + //if (h_player.IsPlaying) + /*if (false) + { if(h_player.GetCurrentTime == 18f) { Debug.Log("snow out"); @@ -90,12 +78,47 @@ public class StatManager : MonoBehaviour Debug.Log("horse fade out"); StartCoroutine("h_fade_out"); } + }*/ + + if(m_timer > trigger_time + h_total_time) + { + m_timer = 0f; } + else if (m_timer > trigger_time + h_total_time - fade_sec) + { + Debug.Log("horse fade out"); + StartCoroutine("h_fade_out"); + } + else if (m_timer > trigger_time + 27f) + { + Debug.Log("snow in"); + StartCoroutine("s_fade_in"); + } + else if (m_timer > trigger_time + 18f) + { + Debug.Log("snow out"); + StartCoroutine("s_fade_out"); + } + else if (m_timer > trigger_time) + { + aud = gameObject.AddComponent(); + aud.loop = false; + aud.playOnAwake = false; + aud.clip = horse_clip; + aud.Play(); + h_player.Play(); + //m_timer = 0f; + Debug.Log("horse fade in"); + + StartCoroutine("h_fade_in"); + loop_count = 0; + } + } IEnumerator h_fade_in() { - h_lerp_val = 0f; + //h_lerp_val = 0f; while (h_grp.alpha < 1f) { h_lerp_val += Time.deltaTime / fade_sec; @@ -107,7 +130,7 @@ public class StatManager : MonoBehaviour IEnumerator h_fade_out() { - h_lerp_val = 1f; + //h_lerp_val = 1f; while (h_grp.alpha > 0f) { h_lerp_val -= Time.deltaTime / fade_sec; @@ -120,7 +143,7 @@ public class StatManager : MonoBehaviour IEnumerator s_fade_in() { - s_lerp_val = 0f; + //s_lerp_val = 0f; while (s_grp.alpha < 1f) { s_lerp_val += Time.deltaTime*2f; @@ -132,7 +155,7 @@ public class StatManager : MonoBehaviour IEnumerator s_fade_out() { - s_lerp_val = 1f; + //s_lerp_val = 1f; while (s_grp.alpha > 0f) { s_lerp_val -= Time.deltaTime*2f; diff --git a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/movieController.cs b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/movieController.cs index 64b5113..fc5b5d9 100644 --- a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/movieController.cs +++ b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/movieController.cs @@ -15,17 +15,19 @@ public class movieController : MonoBehaviour public bool force_destroy; public float destroy_timer; public float wait_sec = 2f; - public float volume = 1f; + //public float volume = 1f; public Vector2 size; public DShowClip snow_01; public DShowClip snow_02; public DShowClip snow_03; public DShowClip snow_04; + /* public AudioClip step1; public AudioClip step2; public AudioClip step3; public AudioClip step4; + */ bool playAud; float alpha; @@ -46,15 +48,15 @@ public class movieController : MonoBehaviour void Update() { - aud.volume = volume; + //aud.volume = volume; GetComponent().sizeDelta = size; - if (playAud && aud.clip != null) + /*if (playAud && aud.clip != null) { Debug.Log(aud.clip.name); aud.Play(); playAud = false; - } + }*/ if(stat == 0){ alpha = 0; if (player.IsPlaying) @@ -92,28 +94,28 @@ public class movieController : MonoBehaviour void OnEnable() { - aud = gameObject.AddComponent(); + //aud = gameObject.AddComponent(); int seed = Random.Range(0, 4); switch (seed){ case 0: player.VideoAsset = snow_01; - aud.clip = step1; + //aud.clip = step1; break; case 1: player.VideoAsset = snow_02; - aud.clip = step2; + //aud.clip = step2; break; case 2: player.VideoAsset = snow_03; - aud.clip = step3; + //aud.clip = step3; break; case 3: player.VideoAsset = snow_04; - aud.clip = step4; + //aud.clip = step4; break; } //aud.Play(); - playAud = true; + //playAud = true; if (name != "RawImage") { diff --git a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/tuio_event.cs b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/tuio_event.cs index 10ea719..b35ac90 100644 --- a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/tuio_event.cs +++ b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/tuio_event.cs @@ -12,7 +12,7 @@ public class tuio_event : MonoBehaviour Dictionary pre_pos = new Dictionary(); [Config] - public bool VisualizeTouches = true; + public bool VisualizeTouches = false; [Config] [Range(1, 30)] @@ -23,7 +23,7 @@ public class tuio_event : MonoBehaviour public int delta_threshold = 100; [Config] - [Range(128, 512)] + [Range(128, 1024)] public int snow_size = 256; [Config] @@ -35,8 +35,8 @@ public class tuio_event : MonoBehaviour public float img_wait_sec = 2f; //[Config] - [Range(0f, 1f)] - public float audio_volume = 1f; + //[Range(0f, 1f)] + //public float audio_volume = 1f; void Update() { @@ -45,7 +45,6 @@ public class tuio_event : MonoBehaviour var touches = TUIOManager.Instance.touches; foreach (var id in touches.Keys) { - movieController movie = null; if (movies.ContainsKey(id) == false) // Add { @@ -56,7 +55,7 @@ public class tuio_event : MonoBehaviour movie.fade_speed = img_fade_speed; movie.wait_sec = img_wait_sec; movie.size = new Vector2(snow_size, snow_size); - movie.volume = audio_volume; + //movie.volume = audio_volume; movie.id = id; movies.Add(id, movie); var rt = movie.transform as RectTransform; @@ -73,6 +72,7 @@ public class tuio_event : MonoBehaviour var rt = movie.transform as RectTransform; //rt.anchoredPosition = touches[id].position; float delta_pos = Vector2.Distance(pre_pos[id], rt.anchoredPosition); + //Debug.Log(delta_pos); if (delta_pos > delta_threshold) { movie.force_destroy = true;