remove snow sfx & fix stat bug

master
tigerchen 6 years ago
parent 6b8bfcad36
commit 2779a2cd89
  1. 4
      08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity
  2. 71
      08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/StatManager.cs
  3. 22
      08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/movieController.cs
  4. 12
      08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/tuio_event.cs

@ -865,8 +865,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
img: {fileID: 2829506254029656376, guid: 8bbc036a3be21954681613cbe4f0e9a8, type: 3} img: {fileID: 2829506254029656376, guid: 8bbc036a3be21954681613cbe4f0e9a8, type: 3}
canvas: {fileID: 1191269362} canvas: {fileID: 1191269362}
VisualizeTouches: 1 VisualizeTouches: 0
frame_gap: 10 frame_gap: 30
delta_threshold: 100 delta_threshold: 100
snow_size: 256 snow_size: 256
img_fade_speed: 0.02 img_fade_speed: 0.02

@ -37,40 +37,28 @@ public class StatManager : MonoBehaviour
loop_count = 0; loop_count = 0;
h_lerp_val = 0f; h_lerp_val = 0f;
s_lerp_val = 1f; s_lerp_val = 1f;
m_timer = h_total_time; // m_timer = h_total_time;
m_timer = 0f;
} }
void Update() 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; m_timer += Time.deltaTime;
Debug.Log(m_timer); //Debug.Log(m_timer);
//if(h_player.IsPlaying == false){ //if(h_player.IsPlaying == false){
if (true)
{
//if (idle_player.Frame == idle_player.TotalNumFrames) //if (idle_player.Frame == idle_player.TotalNumFrames)
//{ //{
// loop_count += 1; // loop_count += 1;
//Debug.Log(loop_count); //Debug.Log(loop_count);
//} //}
//if (loop_count >= loop_to_trigger) //if (loop_count >= loop_to_trigger)
if (m_timer > trigger_time)
{
aud = gameObject.AddComponent<AudioSource>();
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) if(h_player.GetCurrentTime == 18f)
{ {
@ -90,12 +78,47 @@ public class StatManager : MonoBehaviour
Debug.Log("horse fade out"); Debug.Log("horse fade out");
StartCoroutine("h_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<AudioSource>();
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() IEnumerator h_fade_in()
{ {
h_lerp_val = 0f; //h_lerp_val = 0f;
while (h_grp.alpha < 1f) while (h_grp.alpha < 1f)
{ {
h_lerp_val += Time.deltaTime / fade_sec; h_lerp_val += Time.deltaTime / fade_sec;
@ -107,7 +130,7 @@ public class StatManager : MonoBehaviour
IEnumerator h_fade_out() IEnumerator h_fade_out()
{ {
h_lerp_val = 1f; //h_lerp_val = 1f;
while (h_grp.alpha > 0f) while (h_grp.alpha > 0f)
{ {
h_lerp_val -= Time.deltaTime / fade_sec; h_lerp_val -= Time.deltaTime / fade_sec;
@ -120,7 +143,7 @@ public class StatManager : MonoBehaviour
IEnumerator s_fade_in() IEnumerator s_fade_in()
{ {
s_lerp_val = 0f; //s_lerp_val = 0f;
while (s_grp.alpha < 1f) while (s_grp.alpha < 1f)
{ {
s_lerp_val += Time.deltaTime*2f; s_lerp_val += Time.deltaTime*2f;
@ -132,7 +155,7 @@ public class StatManager : MonoBehaviour
IEnumerator s_fade_out() IEnumerator s_fade_out()
{ {
s_lerp_val = 1f; //s_lerp_val = 1f;
while (s_grp.alpha > 0f) while (s_grp.alpha > 0f)
{ {
s_lerp_val -= Time.deltaTime*2f; s_lerp_val -= Time.deltaTime*2f;

@ -15,17 +15,19 @@ public class movieController : MonoBehaviour
public bool force_destroy; public bool force_destroy;
public float destroy_timer; public float destroy_timer;
public float wait_sec = 2f; public float wait_sec = 2f;
public float volume = 1f; //public float volume = 1f;
public Vector2 size; public Vector2 size;
public DShowClip snow_01; public DShowClip snow_01;
public DShowClip snow_02; public DShowClip snow_02;
public DShowClip snow_03; public DShowClip snow_03;
public DShowClip snow_04; public DShowClip snow_04;
/*
public AudioClip step1; public AudioClip step1;
public AudioClip step2; public AudioClip step2;
public AudioClip step3; public AudioClip step3;
public AudioClip step4; public AudioClip step4;
*/
bool playAud; bool playAud;
float alpha; float alpha;
@ -46,15 +48,15 @@ public class movieController : MonoBehaviour
void Update() void Update()
{ {
aud.volume = volume; //aud.volume = volume;
GetComponent<RectTransform>().sizeDelta = size; GetComponent<RectTransform>().sizeDelta = size;
if (playAud && aud.clip != null) /*if (playAud && aud.clip != null)
{ {
Debug.Log(aud.clip.name); Debug.Log(aud.clip.name);
aud.Play(); aud.Play();
playAud = false; playAud = false;
} }*/
if(stat == 0){ if(stat == 0){
alpha = 0; alpha = 0;
if (player.IsPlaying) if (player.IsPlaying)
@ -92,28 +94,28 @@ public class movieController : MonoBehaviour
void OnEnable() void OnEnable()
{ {
aud = gameObject.AddComponent<AudioSource>(); //aud = gameObject.AddComponent<AudioSource>();
int seed = Random.Range(0, 4); int seed = Random.Range(0, 4);
switch (seed){ switch (seed){
case 0: case 0:
player.VideoAsset = snow_01; player.VideoAsset = snow_01;
aud.clip = step1; //aud.clip = step1;
break; break;
case 1: case 1:
player.VideoAsset = snow_02; player.VideoAsset = snow_02;
aud.clip = step2; //aud.clip = step2;
break; break;
case 2: case 2:
player.VideoAsset = snow_03; player.VideoAsset = snow_03;
aud.clip = step3; //aud.clip = step3;
break; break;
case 3: case 3:
player.VideoAsset = snow_04; player.VideoAsset = snow_04;
aud.clip = step4; //aud.clip = step4;
break; break;
} }
//aud.Play(); //aud.Play();
playAud = true; //playAud = true;
if (name != "RawImage") { if (name != "RawImage") {

@ -12,7 +12,7 @@ public class tuio_event : MonoBehaviour
Dictionary<int, Vector2> pre_pos = new Dictionary<int, Vector2>(); Dictionary<int, Vector2> pre_pos = new Dictionary<int, Vector2>();
[Config] [Config]
public bool VisualizeTouches = true; public bool VisualizeTouches = false;
[Config] [Config]
[Range(1, 30)] [Range(1, 30)]
@ -23,7 +23,7 @@ public class tuio_event : MonoBehaviour
public int delta_threshold = 100; public int delta_threshold = 100;
[Config] [Config]
[Range(128, 512)] [Range(128, 1024)]
public int snow_size = 256; public int snow_size = 256;
[Config] [Config]
@ -35,8 +35,8 @@ public class tuio_event : MonoBehaviour
public float img_wait_sec = 2f; public float img_wait_sec = 2f;
//[Config] //[Config]
[Range(0f, 1f)] //[Range(0f, 1f)]
public float audio_volume = 1f; //public float audio_volume = 1f;
void Update() void Update()
{ {
@ -45,7 +45,6 @@ public class tuio_event : MonoBehaviour
var touches = TUIOManager.Instance.touches; var touches = TUIOManager.Instance.touches;
foreach (var id in touches.Keys) foreach (var id in touches.Keys)
{ {
movieController movie = null; movieController movie = null;
if (movies.ContainsKey(id) == false) // Add if (movies.ContainsKey(id) == false) // Add
{ {
@ -56,7 +55,7 @@ public class tuio_event : MonoBehaviour
movie.fade_speed = img_fade_speed; movie.fade_speed = img_fade_speed;
movie.wait_sec = img_wait_sec; movie.wait_sec = img_wait_sec;
movie.size = new Vector2(snow_size, snow_size); movie.size = new Vector2(snow_size, snow_size);
movie.volume = audio_volume; //movie.volume = audio_volume;
movie.id = id; movie.id = id;
movies.Add(id, movie); movies.Add(id, movie);
var rt = movie.transform as RectTransform; var rt = movie.transform as RectTransform;
@ -73,6 +72,7 @@ public class tuio_event : MonoBehaviour
var rt = movie.transform as RectTransform; var rt = movie.transform as RectTransform;
//rt.anchoredPosition = touches[id].position; //rt.anchoredPosition = touches[id].position;
float delta_pos = Vector2.Distance(pre_pos[id], rt.anchoredPosition); float delta_pos = Vector2.Distance(pre_pos[id], rt.anchoredPosition);
//Debug.Log(delta_pos);
if (delta_pos > delta_threshold) if (delta_pos > delta_threshold)
{ {
movie.force_destroy = true; movie.force_destroy = true;

Loading…
Cancel
Save