u s i n g   U n i t y E n g i n e ; 
 u s i n g   S y s t e m ; 
 u s i n g   S y s t e m . C o l l e c t i o n s ; 
 u s i n g   S y s t e m . C o l l e c t i o n s . G e n e r i c ; 
 u s i n g   S y s t e m . I O ; 
 u s i n g   l i v e 2 d . f r a m e w o r k ; 
 u s i n g   l i v e 2 d ; 
 
 
 n a m e s p a c e   U t a g e 
 { 
 	 [ S y s t e m . S e r i a l i z a b l e ] 
 	 p u b l i c   c l a s s   C u s t o m L i p S y n c I n f o 
 	 { 
 	 	 p u b l i c   s t r i n g   m o d e l N a m e ; 
 	 	 p u b l i c   C u s t o m L i p S y n c D a t a [ ]   p a r a m A r r a y ; 
 	 	 [ S y s t e m . S e r i a l i z a b l e ] 
 	 	 p u b l i c   c l a s s   C u s t o m L i p S y n c D a t a 
 	 	 { 
 	 	 	 p u b l i c   c h a r   k e y   =   ' B0' ; 
 	 	 	 p u b l i c   P a r a m D a t a [ ]   p a r a m A r r a y ; 
 	 	 	 [ S y s t e m . S e r i a l i z a b l e ] 
 	 	 	 p u b l i c   c l a s s   P a r a m D a t a 
 	 	 	 { 
 	 	 	 	 p u b l i c   s t r i n g   n a m e ; 
 	 	 	 	 p u b l i c   f l o a t   v a l u e ; 
 	 	 	 } 
 	 	 } 
 	 	 p u b l i c   C u s t o m L i p S y n c D a t a   F i n d D a t a ( c h a r   k e y ,   c h a r   d e f a u l t K e y ) 
 	 	 { 
 	 	 	 f o r e a c h   ( v a r   i t e m   i n   p a r a m A r r a y ) 
 	 	 	 { 
 	 	 	 	 i f   ( i t e m . k e y   = =   k e y )   r e t u r n   i t e m ; 
 	 	 	 } 
 	 	 	 f o r e a c h   ( v a r   i t e m   i n   p a r a m A r r a y ) 
 	 	 	 { 
 	 	 	 	 i f   ( i t e m . k e y   = =   d e f a u l t K e y )   r e t u r n   i t e m ; 
 	 	 	 } 
 	 	 	 r e t u r n   n u l l ; 
 	 	 } 
 	 } 
 
 	 / / /   < s u m m a r y > 
 	 / / /   [(un0L i v e 2 D n0000000{t000
 	 / / /   < / s u m m a r y > 
 	 p u b l i c   c l a s s   L i v e 2 D M o d e l L i p S y n c 
 	 { 
 	 	 / / S00L0[hQk0J00c0_0K0
 	 	 b o o l   i s C o m p l e t e   =   t r u e ; 
 	 	 f l o a t   l a s t P a r a m   =   0 ; 
 
 	 	 i n t e r n a l   v o i d   S t o p L i p S y n c ( L i v e 2 D M o d e l U n i t y   l i v e 2 D M o d e l ) 
 	 	 { 
 	 	 	 i f   ( ! i s C o m p l e t e ) 
 	 	 	 { 
 
 	 	 	 	 f l o a t   p a r a m   =   l i v e 2 D M o d e l . g e t P a r a m F l o a t ( L 2 D S t a n d a r d I D . P A R A M _ M O U T H _ O P E N _ Y ) ; 
 
 	 	 	 	 / / S0;bY0
 
 	 	 	 	 l i v e 2 D M o d e l . s e t P a r a m F l o a t ( L 2 D S t a n d a r d I D . P A R A M _ M O U T H _ O P E N _ Y ,   ( l a s t P a r a m * 3   +   p a r a m ) / 4 ,   0 . 8 f ) ; 
 	 	 	 	 l a s t P a r a m   =   l i v e 2 D M o d e l . g e t P a r a m F l o a t ( L 2 D S t a n d a r d I D . P A R A M _ M O U T H _ O P E N _ Y ) ; 
 	 	 	 	 i f   ( M a t h . A b s ( l a s t P a r a m   -   p a r a m )   <   0 . 0 1 f ) 
 	 	 	 	 { 
 	 	 	 	 	 i s C o m p l e t e   =   t r u e ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 
 	 	 i n t e r n a l   v o i d   U p d a t e V o i c e L i p S y n c P a r a m ( L i v e 2 D M o d e l U n i t y   l i v e 2 D M o d e l ,   f l o a t   v o l u m e ,   b o o l   i s S m o o t h i n g ) 
 	 	 { 
 	 	 	 l i v e 2 D M o d e l . s e t P a r a m F l o a t ( L 2 D S t a n d a r d I D . P A R A M _ M O U T H _ O P E N _ Y ,   C a l c V o i c e L i p S y n c V a l u e ( v o l u m e ,   i s S m o o t h i n g ) ,   0 . 8 f ) ; 
 
 	 	 	 l a s t P a r a m   =   l i v e 2 D M o d e l . g e t P a r a m F l o a t ( L 2 D S t a n d a r d I D . P A R A M _ M O U T H _ O P E N _ Y ) ; 
 	 	 	 i s C o m p l e t e   =   f a l s e ; 
 	 	 } 
 
 	 	 i n t e r n a l   v o i d   U p d a t e T e x t L y p S y n c P a r a m ( L i v e 2 D M o d e l U n i t y   l i v e 2 D M o d e l ,   f l o a t   t e x t L i p S y n c S p e e d ) 
 	 	 { 
 	 	 	 l i v e 2 D M o d e l . s e t P a r a m F l o a t ( L 2 D S t a n d a r d I D . P A R A M _ M O U T H _ O P E N _ Y ,   C a l c T e x t L i p S y n c V a l u e ( t e x t L i p S y n c S p e e d ) ,   0 . 8 f ) ; 
 
 	 	 	 l a s t P a r a m   =   l i v e 2 D M o d e l . g e t P a r a m F l o a t ( L 2 D S t a n d a r d I D . P A R A M _ M O U T H _ O P E N _ Y ) ; 
 	 	 	 i s C o m p l e t e   =   f a l s e ; 
 	 	 } 
 
 	 	 i n t e r n a l   v o i d   U p d a t e T e x t C u s t o m L y p S y n c P a r a m ( L i v e 2 D M o d e l U n i t y   l i v e 2 D M o d e l ,   c h a r   w o r d ,   C u s t o m L i p S y n c I n f o   i n f o , f l o a t   t e x t L i p S y n c S p e e d ) 
 	 	 { 
 	 	 	 f l o a t   v a l u e   =   C a l c T e x t L i p S y n c V a l u e ( t e x t L i p S y n c S p e e d ) ; 
 / / 	 	 	 v a l u e   =   0 . 5 f   *   v a l u e   +   0 . 5 f ; 
 	 	 	 v a l u e   =   1 ; 
 	 	 	 c h a r   b o i n   =   T o B o i n ( w o r d ) ; 
 	 	 	 C u s t o m L i p S y n c I n f o . C u s t o m L i p S y n c D a t a   d a t a   =   i n f o . F i n d D a t a ( b o i n , ' B0' ) ; 
 / / 	 	 	 D e b u g . L o g (   d a t a . k e y   ) ; 
 	 	 	 f o r e a c h   ( v a r   i t e m   i n   d a t a . p a r a m A r r a y ) 
 	 	 	 { 
 	 	 	 	 l i v e 2 D M o d e l . s e t P a r a m F l o a t ( i t e m . n a m e ,   i t e m . v a l u e * v a l u e ,   0 . 8 f ) ; 
 	 	 	 } 
 / * 	 	 	 f o r e a c h (   v a r   p a r a m N a m e   i n   i n f o . p a r a m N a m e A r r a y   ) 
 	 	 	 { 
 	 	 	 	 l i v e 2 D M o d e l . s e t P a r a m F l o a t ( p a r a m N a m e ,   v a l u e ,   0 . 8 f ) ; 
 	 	 	 } * / 
 	 	 	 i s C o m p l e t e   =   f a l s e ; 
 	 	 } 
 
 
 	 	 c l a s s   B o i n D a t a 
 	 	 { 
 	 	 	 p u b l i c   c h a r   b o i n ; 
 	 	 	 p u b l i c   s t r i n g   w o r d s ; 
 	 	 	 p u b l i c   B o i n D a t a ( c h a r   b o i n ,   s t r i n g   w o r d s ) 
 	 	 	 { 
 	 	 	 	 t h i s . b o i n   =   b o i n ; 
 	 	 	 	 t h i s . w o r d s   =   w o r d s ; 
 	 	 	 } 
 	 	 } 
 	 	 B o i n D a t a [ ]   b o i n D a t a L i s t   =   n e w   B o i n D a t a [ ] 
 	 	 { 
 	 	 	 n e w   B o i n D a t a ( ' B0' , " B0K0U0_0j0o0~0000" ) , 
 	 	 	 n e w   B o i n D a t a ( ' D0' , " D0M0W0a0k0r000" ) , 
 	 	 	 n e w   B o i n D a t a ( ' F0' , " F0O0Y0d0l0u0000" ) , 
 	 	 	 n e w   B o i n D a t a ( ' H0' , " H0Q0[0f0m0x000" ) , 
 	 	 	 n e w   B o i n D a t a ( ' J0' , " J0S0]0h0n0{00000" ) , 
 	 	 	 n e w   B o i n D a t a ( ' 0' , " 0 0  " ) , 
 	 	 } ; 
 
 	 	 c h a r   T o B o i n ( c h a r   w o r d ) 
 	 	 { 
 	 	 	 f o r e a c h   ( v a r   i t e m   i n   b o i n D a t a L i s t ) 
 	 	 	 { 
 	 	 	 	 i f   ( i t e m . w o r d s . I n d e x O f ( w o r d ) > = 0 )   r e t u r n   i t e m . b o i n ; 
 	 	 	 } 
 	 	 	 r e t u r n   ' B0' ; 
 	 	 } 
 
 	 	 f l o a t   l a s t V o l u m e   =   0 ; 
 	 	 / /   000000000n0$P0S_
 	 	 f l o a t   C a l c V o i c e L i p S y n c V a l u e ( f l o a t   c u r r e n t V o l u m e ,   b o o l   i s S m o o t h i n g   ) 
 	 	 { 
 	 	 	 f l o a t   v o l u m e   =   0 ; 
 	 	 	 i f   ( i s S m o o t h i n g ) 
 	 	 	 { 
 	 	 	 	 i f   ( M a t h f . A b s ( l a s t V o l u m e   -   c u r r e n t V o l u m e )   <   0 . 2 f ) 
 	 	 	 	 { 
 	 	 	 	 	 v o l u m e   =   l a s t V o l u m e   *   0 . 9 f   +   c u r r e n t V o l u m e   *   0 . 1 f ; 
 	 	 	 	 } 
 	 	 	 	 e l s e   i f   ( l a s t V o l u m e   -   c u r r e n t V o l u m e   >   0 . 2 f ) 
 	 	 	 	 { 
 	 	 	 	 	 v o l u m e   =   l a s t V o l u m e   *   0 . 7 f   +   c u r r e n t V o l u m e   *   0 . 3 f ; 
 	 	 	 	 } 
 	 	 	 	 e l s e 
 	 	 	 	 { 
 	 	 	 	 	 v o l u m e   =   l a s t V o l u m e   *   0 . 2 f   +   c u r r e n t V o l u m e   *   0 . 8 f ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 v o l u m e   =   c u r r e n t V o l u m e ; 
 	 	 	 } 
 	 	 	 l a s t V o l u m e   =   v o l u m e ; 
 	 	 	 r e t u r n   v o l u m e ; 
 	 	 } 
 
 	 	 / /   0000000000n0$PS_
 	 	 f l o a t   C a l c T e x t L i p S y n c V a l u e ( f l o a t   t e x t L i p S y n c S p e e d ) 
 	 	 { 
 	 	 	 f l o a t   t   =   M a t h f . P i n g P o n g ( T i m e . t i m e   *   t e x t L i p S y n c S p e e d ,   1 . 0 f ) ; 
 	 	 	 f l o a t   l i p S y n c V a l u e   =   M a t h f . S i n ( t   *   M a t h f . P I ) ; 
 	 	 	 r e t u r n   l i p S y n c V a l u e ;   
 	 	 } 
 	 } 
 } 
 