/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 / /   U T A G E :   U n i t y   T e x t   A d v e n t u r e   G a m e   E n g i n e 
 / /   C o p y r i g h t   2 0 1 4   R y o h e i   T o k i m u r a 
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 u s i n g   S y s t e m . I O ; 
 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   U n i t y E n g i n e ; 
 u s i n g   U n i t y E n g i n e . E v e n t s ; 
 u s i n g   U n i t y E n g i n e . E v e n t S y s t e m s ; 
 u s i n g   l i v e 2 d ; 
 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   S y s t e m ; 
 
 n a m e s p a c e   U t a g e 
 { 
 
 	 / / /   < s u m m a r y > 
 	 / / /   0000R0fH0_jd0M0n000000h:y
 	 / / /   < / s u m m a r y > 
 	 [ A d d C o m p o n e n t M e n u ( " U t a g e / L i v e 2 D / I n t e r n a l / G r a p h i c O b j e c t L i v e 2 D " ) ] 
 	 p u b l i c   c l a s s   A d v G r a p h i c O b j e c t L i v e 2 D   :   A d v G r a p h i c O b j e c t 
 	 { 
 	 	 L i v e 2 D S e t t i n g s   S e t t i n g s   {   g e t   {   r e t u r n   L i v e 2 D F o r U t a g e . G e t I n s t a n c e ( ) . S e t t i n g s ;   }   } 
 
 	 	 / / s(Wn0000n00000000000j0i0n000000j0i0n0bM0k0W0_00n0	
 	 	 p u b l i c   o v e r r i d e   G a m e O b j e c t   C u r r e n t O b j e c t   {   g e t   {   r e t u r n   l i v e 2 D O b j . g a m e O b j e c t ;   }   } 
 
 	 	 p r o t e c t e d   T r a n s f o r m   c h i l d R o o t ; 
 
 	 	 L i v e 2 D O b j e c t   l i v e 2 D O b j ; 
 
 	 	 s t r i n g   c u r r e n t M o t i o n   =   " " ; 
 	 	 M o t i o n P l a y T y p e   c u r r e n t M o t i o n P l a y T y p e   =   M o t i o n P l a y T y p e . D e f a u l t ; 
 	 	 s t r i n g   c u r r e n t E x p r e s s i o n   =   " " ; 
 
 	 	 i n t e r n a l   o v e r r i d e   v o i d   O n I n i t ( ) 
 	 	 { 
 	 	 	 c h i l d R o o t   =   U t a g e T o o l K i t . A d d C h i l d ( t h i s . t r a n s f o r m ,   n e w   G a m e O b j e c t ( " r o o t " ) ) . t r a n s f o r m ; 
 	 	 } 
 
 	 	 / / c;u
 	 	 i n t e r n a l   o v e r r i d e   v o i d   O n D r a w ( G r a p h i c I n f o L i s t   g r a p h i c ,   f l o a t   f a d e T i m e ) 
 	 	 { 
 	 	 	 i f   ( G r a p h i c   = =   g r a p h i c ) 
 	 	 	 { 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 i f   ( l i v e 2 D O b j   ! =   n u l l ) 
 	 	 	 	 { 
 	 	 	 	 	 G a m e O b j e c t . D e s t r o y ( l i v e 2 D O b j . g a m e O b j e c t ) ; 
 	 	 	 	 } 
 
 	 	 	 	 l i v e 2 D O b j   =   U t a g e T o o l K i t . A d d C h i l d G a m e O b j e c t C o m p o n e n t < L i v e 2 D O b j e c t > ( c h i l d R o o t ,   g r a p h i c . K e y ) ; 
 	 	 	 	 l i v e 2 D O b j . L o a d (   t h i s . g a m e O b j e c t . n a m e ,   E n g i n e ,   g r a p h i c ,   P i x e l s T o U n i t s ) ; 
 
 	 	 	 	 / / 0000$P00000n0-[
 	 	 	 	 G r a p h i c I n f o   m a i n   =   g r a p h i c . M a i n ; 
 	 	 	 	 f l o a t   w   =   m a i n . S c a l e . x   *   l i v e 2 D O b j . M o d e l D a t a . W i d t h ; 
 	 	 	 	 f l o a t   h   =   m a i n . S c a l e . y   *   l i v e 2 D O b j . M o d e l D a t a . H e i g h t ; 
 	 	 	 	 / / 0000$Pn0-[h00j0\0K0Z $P00000-[W0j0D0h0D0Q0j0D0
 	 	 	 	 c h i l d R o o t . t r a n s f o r m . l o c a l S c a l e   =   n e w   V e c t o r 3 ( m a i n . S c a l e . x ,   m a i n . S c a l e . y ,   - 1 . 0 f ) ; 
 	 	 	 	 c h i l d R o o t . t r a n s f o r m . l o c a l P o s i t i o n   =   n e w   V e c t o r 3 ( w   *   - ( m a i n . P i v o t . x   -   0 . 5 f ) ,   h   *   - ( m a i n . P i v o t . y   -   0 . 5 f ) ,   0 ) ; 
 / * 
 	 	 	 	 i f   ( S e t t i n g s . L i v e 2 D R e n d e r T y p e   = =   L i v e 2 D S e t t i n g s . R e n d e r T y p e . R e n d e r T e x t u r e ) 
 	 	 	 	 { 
 	 	 	 	 	 C r e a t e R e n d e t T e x t u r e O b j e c t ( ) ; 
 	 	 	 	 	 l i v e 2 D O b j . S e t R e n d e r T e x t u r e ( ) ; 
 	 	 	 	 } * / 
 / / 	 	 	 	 l i v e 2 D O b j . F a d e I n ( f a d e T i m e ) ; 
 	 	 	 } 
 	 	 } 
 
 	 	 v o i d   C r e a t e R e n d e t T e x t u r e O b j e c t ( ) 
 	 	 { 
 / / 	 	 	 R e n d e r T e x t u r e   t e x t u r e   =   n e w   R e n d e r T e x t u r e ( 2 5 6 ,   2 5 6 ,   1 6 ,   R e n d e r T e x t u r e F o r m a t . A R G B 3 2 ) ; 
 / / 	 	 	 t e x t u r e . C r e a t e ( ) ; 
 / / 	 	 	 S p r i t e 2 D   s p r i t e   =   U t a g e T o o l K i t . A d d C h i l d G a m e O b j e c t C o m p o n e n t < S p r i t e 2 D > ( t h i s . t r a n s f o r m ,   " R e n d e r T a r g e t " ) ; 
 / / 	 	 	 s p r i t e . S p r i t e   =   t e x t u r e ; 
 / / 	 	 	 s p r i t e . L o c a l O r d e r I n L a y e r   =   L a y e r . S e t t i n g D a t a . O r d e r ; 
 	 	 } 
 
 	 	 / / c;u
 	 	 i n t e r n a l   o v e r r i d e   v o i d   O n D r a w A r g C u s t o m ( A d v G r a p h i c O p e r a i t o n A r g   a r g ) 
 	 	 { 
 	 	 	 / / 00000	Yf
 	 	 	 s t r i n g   m o t i o n N a m e   =   a r g . A r g 2 ; 
 	 	 	 i f   ( ! s t r i n g . I s N u l l O r E m p t y ( m o t i o n N a m e ) ) 
 	 	 	 { 
 	 	 	 	 i f (   ! T r y S e t M o t i o n ( a r g . A r g 2 ,   a r g . P l a y T y p e )   ) 
 	 	 	 	 { 
 	 	 	 	 	 D e b u g . L o g E r r o r ( a r g . R o w D a t a . T o E r r o r S t r i n g ( m o t i o n N a m e   +   " i s   n o t   m o t i o n   n a m e " ) ) ; 
 	 	 	 	 } 
 	 	 	 	 i f   ( E n g i n e . P a g e . C h e c k S k i p ( ) ) 
 	 	 	 	 { 
 	 	 	 	 	 l i v e 2 D O b j . M o d e l D a t a . C h a g n g e C u r r e n t M o t i o n T o N o F a d e ( ) ; 
 	 	 	 	 } 
 	 	 	 } 
 
 	 	 	 i f   ( ! a r g . I s P o s t i o n A r g s ) 
 	 	 	 { 
 	 	 	 	 / / h`	Yf
 	 	 	 	 s t r i n g   e x p r e s s i o n   =   a r g . A r g 4 ; 
 	 	 	 	 i f   ( ! T r y S e t E x p r e s s i o n ( e x p r e s s i o n ) ) 
 	 	 	 	 { 
 	 	 	 	 	 D e b u g . L o g E r r o r ( a r g . R o w D a t a . T o E r r o r S t r i n g ( e x p r e s s i o n   +   " i s   n o t   e x p r e s s i o n   n a m e " ) ) ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 
 	 	 / / 000	Yf
 	 	 b o o l   T r y S e t M o t i o n ( s t r i n g   m o t i o n N a m e ,   M o t i o n P l a y T y p e   m o t i o n P l a y T y p e ) 
 	 	 { 
 	 	 	 c u r r e n t M o t i o n   =   m o t i o n N a m e ; 
 	 	 	 c u r r e n t M o t i o n P l a y T y p e   =   m o t i o n P l a y T y p e ; 
 	 	 	 / / ~0Z0o0000000n0	Yf0f00
 	 	 	 i f   ( ! l i v e 2 D O b j . M o d e l D a t a . C h a n g e M o t i o n ( m o t i o n N a m e ,   m o t i o n P l a y T y p e ) ) 
 	 	 	 { 
 	 	 	 	 / / 00000
TX00j0D04XT00000
Tg0000000000
 	 	 	 	 i f   ( ! l i v e 2 D O b j . M o d e l D a t a . C h a n g e R a n d o m M o t i o n ( m o t i o n N a m e ) ) 
 	 	 	 	 { 
 	 	 	 	 	 r e t u r n   f a l s e ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 r e t u r n   t r u e ; 
 	 	 } 
 
 	 	 / / h`	Yf
 	 	 b o o l   T r y S e t E x p r e s s i o n ( s t r i n g   e x p r e s s i o n ) 
 	 	 { 
 	 	 	 c u r r e n t E x p r e s s i o n   =   e x p r e s s i o n ; 
 	 	 	 i f   ( ! s t r i n g . I s N u l l O r E m p t y ( e x p r e s s i o n ) ) 
 	 	 	 { 
 	 	 	 	 i f   ( e x p r e s s i o n   = =   " C l e a r " ) 
 	 	 	 	 { 
 	 	 	 	 	 l i v e 2 D O b j . M o d e l D a t a . S t o p E x p r e s s i o n ( ) ; 
 	 	 	 	 	 c u r r e n t E x p r e s s i o n   =   " " ; 
 	 	 	 	 } 
 	 	 	 	 e l s e   i f   ( ! l i v e 2 D O b j . M o d e l D a t a . C h a n g e E x p r e s s i o n ( e x p r e s s i o n ) ) 
 	 	 	 	 { 
 	 	 	 	 	 r e t u r n   f a l s e ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 r e t u r n   t r u e ; 
 	 	 } 
 
 	 	 / / 0000000Qt
 	 	 i n t e r n a l   o v e r r i d e   v o i d   O n F a d e O u t ( f l o a t   f a d e T i m e ) 
 	 	 { 
 / / 	 	 	 l i v e 2 D O b j . F a d e O u t ( f a d e T i m e ) ; 
 / / 	 	 	 G a m e O b j e c t . D e s t r o y ( t h i s . g a m e O b j e c t , f a d e T i m e ) ; 
 	 	 	 G a m e O b j e c t . D e s t r o y ( t h i s . g a m e O b j e c t ) ; 
 	 	 } 
 
 	 	 / / 00000(un0rL0	YSW0_0h0M0
 	 	 i n t e r n a l   o v e r r i d e   v o i d   O n E f f e c t C o l o r s C h a n g e ( E f f e c t C o l o r s   c o l o r s ) 
 	 	 { 
 	 	 	 i f   ( C u r r e n t O b j e c t   & &   l i v e 2 D O b j   ! =   n u l l ) 
 	 	 	 { 
 	 	 	 	 l i v e 2 D O b j . S e t E f f e c t C o l o r ( c o l o r s . M u l C o l o r ) ; 
 	 	 	 } 
 	 	 } 
 	 	 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   000000eW0O0-[
 	 	 / / /   < / s u m m a r y > 
 	 	 i n t e r n a l   o v e r r i d e   L i s t < C o m p o n e n t >   A d d N e w E v e n t C o l l i d e r s ( G a m e O b j e c t   g o ,   b o o l   i s P o l y g o n ) 
 	 	 { 
 	 	 	 / / 00000k0000000d0Q00
 	 	 	 A d d E v e n t C o l l i d e r < B o x C o l l i d e r 2 D > ( g o ) ; 
 	 	 	 U p d a t e E v e n t C o l l i d e r S i z e ( ) ; 
 	 	 	 r e t u r n   e v e n t C o l l i d e r s ; 
 	 	 } 
 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   0000Bfn0Qt
 	 	 / / /   8^o0{v2U00_0000000|Tv0`0Q0
 	 	 / / /   _k0_X0f0o v e r r i d e W0f0Qt0fM0cH00
 	 	 / / /   < / s u m m a r y > 
 	 	 i n t e r n a l   o v e r r i d e   v o i d   O n C l i c k ( B a s e E v e n t D a t a   e v e n t D a t a ,   S t r i n g G r i d R o w   r o w ,   U n i t y A c t i o n < B a s e E v e n t D a t a >   a c t i o n ) 
 	 	 { 
 	 	 	 P o i n t e r E v e n t D a t a   d a t a   =   e v e n t D a t a   a s   P o i n t e r E v e n t D a t a ; 
 	 	 	 s t r i n g   p a r t s N a m e   =   A d v P a r s e r . P a r s e C e l l < s t r i n g > ( r o w ,   A d v C o l u m n N a m e . A r g 6 ) ; 
 	 	 	 i f   ( l i v e 2 D O b j . H i t T e s t ( p a r t s N a m e ,     W r a p p e r U n i t y V e r s i o n . G e t W o r l d P o s i t i o n F r o m P o i n t e r E v e n t D a t a (   d a t a )   ) ) 
 	 	 	 { 
 	 	 	 	 a c t i o n . I n v o k e ( e v e n t D a t a ) ; 
 	 	 	 } 
 	 	 } 
 
 	 	 v o i d   U p d a t e ( ) 
 	 	 { 
 	 	 	 U p d a t e E v e n t C o l l i d e r S i z e ( ) ; 
 	 	 } 
 
 	 	 v o i d   U p d a t e E v e n t C o l l i d e r S i z e ( ) 
 	 	 { 
 	 	 	 f o r e a c h   ( C o m p o n e n t   i t e m   i n   e v e n t C o l l i d e r s ) 
 	 	 	 { 
 	 	 	 	 B o x C o l l i d e r 2 D   c o l l i d e r   =   i t e m   a s   B o x C o l l i d e r 2 D ; 
 	 	 	 	 i f   ( c o l l i d e r   ! =   n u l l ) 
 	 	 	 	 { 
 	 	 	 	 	 T r a n s f o r m   c o l l i d e r T r a n s f o r m   =   c o l l i d e r . t r a n s f o r m ; 
 	 	 	 	 	 R e c t   r e c t ; 
 	 	 	 	 	 i f (   l i v e 2 D O b j . T r y G e t T o t a l H i t R e c t ( o u t   r e c t ) ) 
 	 	 	 	 	 { 
 	 	 	 	 	 	 W r a p p e r U n i t y V e r s i o n . S e t B o x C o l l i d e r 2 D O f f s e t ( c o l l i d e r , c o l l i d e r T r a n s f o r m . I n v e r s e T r a n s f o r m P o i n t ( r e c t . c e n t e r ) ) ; 
 	 	 	 	 	 	 c o l l i d e r . s i z e   =   c o l l i d e r T r a n s f o r m . I n v e r s e T r a n s f o r m V e c t o r ( r e c t . s i z e ) ; 
 	 	 	 	 	 } 
 	 	 	 	 } 
 	 	 	 } 
 	 	 } 
 
 	 	 c o n s t   i n t   L i v e 2 D V e r s i o n   =   0 ; 
 	 	 / / /   000000fM00Qt
 	 	 i n t e r n a l   o v e r r i d e   v o i d   O n W r i t e ( B i n a r y W r i t e r   w r i t e r ) 
 	 	 { 
 	 	 	 w r i t e r . W r i t e ( V e r s i o n ) ; 
 	 	 	 w r i t e r . W r i t e ( c u r r e n t M o t i o n ) ; 
 	 	 	 w r i t e r . W r i t e ( ( i n t ) c u r r e n t M o t i o n P l a y T y p e ) ; 
 	 	 	 w r i t e r . W r i t e ( c u r r e n t E x p r e s s i o n ) ; 
 	 	 } 
 
 	 	 / / /   000000n00S00
 	 	 i n t e r n a l   o v e r r i d e   v o i d   O n R e a d ( G r a p h i c I n f o L i s t   g r a p h i c ,   B i n a r y R e a d e r   r e a d e r ) 
 	 	 { 
 	 	 	 i n t   v e r s i o n   =   r e a d e r . R e a d I n t 3 2 ( ) ; 
 	 	 	 i f   ( v e r s i o n   > =   L i v e 2 D V e r s i o n ) 
 	 	 	 { 
 	 	 	 	 c u r r e n t M o t i o n   =   r e a d e r . R e a d S t r i n g ( ) ; 
 	 	 	 	 c u r r e n t M o t i o n P l a y T y p e   =   ( M o t i o n P l a y T y p e ) r e a d e r . R e a d I n t 3 2 ( ) ; 
 	 	 	 	 c u r r e n t E x p r e s s i o n   =   r e a d e r . R e a d S t r i n g ( ) ; 
 	 	 	 	 S t a r t C o r o u t i n e ( C o L o a d G r a p h i c ( g r a p h i c ,   ( )   = >   O n R e a d C o m p l e t e ( g r a p h i c ) ) ) ; 
 	 	 	 } 
 	 	 	 e l s e 
 	 	 	 { 
 	 	 	 	 D e b u g . L o g E r r o r ( L a n g u a g e E r r o r M s g . L o c a l i z e T e x t F o r m a t ( E r r o r M s g . U n k n o w n V e r s i o n ,   v e r s i o n ) ) ; 
 	 	 	 } 
 	 	 } 
 
 	 	 i n t e r n a l   o v e r r i d e   v o i d   O n R e a d C o m p l e t e ( G r a p h i c I n f o L i s t   g r a p h i c ) 
 	 	 { 
 	 	 	 b a s e . O n R e a d C o m p l e t e ( g r a p h i c ) ; 
 	 	 	 T r y S e t M o t i o n ( c u r r e n t M o t i o n ,   c u r r e n t M o t i o n P l a y T y p e ) ; 
 	 	 	 T r y S e t E x p r e s s i o n ( c u r r e n t E x p r e s s i o n ) ; 
 	 	 } 
 
 	 } 
 } 
 