separate audio from video & snow size config

master
tigerchen 6 years ago
parent bdf682a65d
commit f2bd9dffe0
  1. 101
      08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity
  2. 41
      08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/StatManager.cs
  3. 3
      08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/movieController.cs
  4. 5
      08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/tuio_event.cs

@ -308,6 +308,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 388490436} - component: {fileID: 388490436}
- component: {fileID: 388490435} - component: {fileID: 388490435}
- component: {fileID: 388490437}
m_Layer: 0 m_Layer: 0
m_Name: StatManager m_Name: StatManager
m_TagString: Untagged m_TagString: Untagged
@ -328,11 +329,12 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
fade_sec: 1 fade_sec: 1
loop_to_trigger: 4 loop_to_trigger: 1
idle_player: {fileID: 540220394} idle_player: {fileID: 540220394}
h_player: {fileID: 1232323602} h_player: {fileID: 1232323602}
h_grp: {fileID: 229700563} h_grp: {fileID: 229700563}
s_grp: {fileID: 1191269363} s_grp: {fileID: 1191269363}
horse_clip: {fileID: 8300000, guid: 10adc664ed6fa7641bc9be8e020216cf, type: 3}
--- !u!4 &388490436 --- !u!4 &388490436
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -347,6 +349,102 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 6 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &388490437
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 388490434}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 1320bfe591757af4ca58ba59f1dda347, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 1
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1001 &472923654 --- !u!1001 &472923654
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -770,6 +868,7 @@ MonoBehaviour:
VisualizeTouches: 1 VisualizeTouches: 1
frame_gap: 10 frame_gap: 10
delta_threshold: 100 delta_threshold: 100
snow_size: 256
img_fade_speed: 0.02 img_fade_speed: 0.02
img_wait_sec: 2 img_wait_sec: 2
audio_volume: 1 audio_volume: 1

@ -20,10 +20,16 @@ public class StatManager : MonoBehaviour
public DShowMoviePlayer h_player; public DShowMoviePlayer h_player;
public CanvasGroup h_grp; public CanvasGroup h_grp;
public CanvasGroup s_grp; public CanvasGroup s_grp;
public AudioClip horse_clip;
AudioSource aud;
int loop_count; int loop_count;
float h_lerp_val; float h_lerp_val;
float s_lerp_val; float s_lerp_val;
float h_total_time = 30f;
float i_total_time = 8f;
float trigger_time;
float m_timer;
void Start() void Start()
{ {
@ -31,18 +37,32 @@ 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;
} }
void Update() void Update()
{ {
if(h_player.IsPlaying == false){ trigger_time = i_total_time * loop_to_trigger + h_total_time;
if (idle_player.Frame == idle_player.TotalNumFrames) m_timer += Time.deltaTime;
{ Debug.Log(m_timer);
loop_count += 1;
//if(h_player.IsPlaying == false){
if (true)
{
//if (idle_player.Frame == idle_player.TotalNumFrames)
//{
// 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"); Debug.Log("horse fade in");
h_player.Play(); h_player.Play();
StartCoroutine("h_fade_in"); StartCoroutine("h_fade_in");
@ -50,7 +70,7 @@ public class StatManager : MonoBehaviour
} }
} }
else if (h_player.IsPlaying)
{ {
if(h_player.GetCurrentTime == 18f) if(h_player.GetCurrentTime == 18f)
{ {
@ -64,9 +84,9 @@ public class StatManager : MonoBehaviour
StartCoroutine("s_fade_in"); StartCoroutine("s_fade_in");
} }
if(h_player.Frame == h_player.TotalNumFrames - fade_sec * 30) if(h_player.GetCurrentTime > h_total_time - fade_sec)
{ {
idle_player.Frame = 0; //idle_player.Frame = 0;
Debug.Log("horse fade out"); Debug.Log("horse fade out");
StartCoroutine("h_fade_out"); StartCoroutine("h_fade_out");
} }
@ -94,6 +114,7 @@ public class StatManager : MonoBehaviour
h_grp.alpha = Mathf.Lerp(0f, 1f, h_lerp_val); h_grp.alpha = Mathf.Lerp(0f, 1f, h_lerp_val);
yield return null; yield return null;
} }
Destroy(aud);
yield break; yield break;
} }

@ -16,6 +16,7 @@ public class movieController : MonoBehaviour
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 DShowClip snow_01; public DShowClip snow_01;
public DShowClip snow_02; public DShowClip snow_02;
public DShowClip snow_03; public DShowClip snow_03;
@ -46,6 +47,8 @@ public class movieController : MonoBehaviour
void Update() void Update()
{ {
aud.volume = volume; aud.volume = volume;
GetComponent<RectTransform>().sizeDelta = size;
if (playAud && aud.clip != null) if (playAud && aud.clip != null)
{ {
Debug.Log(aud.clip.name); Debug.Log(aud.clip.name);

@ -22,6 +22,10 @@ public class tuio_event : MonoBehaviour
[Range(50, 300)] [Range(50, 300)]
public int delta_threshold = 100; public int delta_threshold = 100;
[Config]
[Range(128, 512)]
public int snow_size = 256;
[Config] [Config]
[Range(0.01f, 0.1f)] [Range(0.01f, 0.1f)]
public float img_fade_speed = 0.02f; public float img_fade_speed = 0.02f;
@ -51,6 +55,7 @@ public class tuio_event : MonoBehaviour
movie = g.AddComponent<movieController>(); movie = g.AddComponent<movieController>();
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.volume = audio_volume; movie.volume = audio_volume;
movie.id = id; movie.id = id;
movies.Add(id, movie); movies.Add(id, movie);

Loading…
Cancel
Save