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:
- component: {fileID: 388490436}
- component: {fileID: 388490435}
- component: {fileID: 388490437}
m_Layer: 0
m_Name: StatManager
m_TagString: Untagged
@ -328,11 +329,12 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
fade_sec: 1
loop_to_trigger: 4
loop_to_trigger: 1
idle_player: {fileID: 540220394}
h_player: {fileID: 1232323602}
h_grp: {fileID: 229700563}
s_grp: {fileID: 1191269363}
horse_clip: {fileID: 8300000, guid: 10adc664ed6fa7641bc9be8e020216cf, type: 3}
--- !u!4 &388490436
Transform:
m_ObjectHideFlags: 0
@ -347,6 +349,102 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 6
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
PrefabInstance:
m_ObjectHideFlags: 0
@ -770,6 +868,7 @@ MonoBehaviour:
VisualizeTouches: 1
frame_gap: 10
delta_threshold: 100
snow_size: 256
img_fade_speed: 0.02
img_wait_sec: 2
audio_volume: 1

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

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

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

Loading…
Cancel
Save