@@ -54,15 +54,15 @@ public void UpdateArm(float move)
5454 public const float ArmSpeed = 240 ;
5555 public const float ArmSpeedRetract = 112 ;
5656
57- public static readonly Color IdleColor = Calc . HexToColor ( "0061ff" ) ;
58- public static readonly Color ClimbedOnColor = Calc . HexToColor ( "ff38f1" ) ;
59- public static readonly Color DashColor = Calc . HexToColor ( "ff0033" ) ;
60- public static readonly Color RetractColor = Calc . HexToColor ( "4800ff" ) ;
61- public static readonly Color IdleAltColor = Calc . HexToColor ( "00d0ff" ) ;
62- public static readonly Color ClimbedOnAltColor = Calc . HexToColor ( "f432ff" ) ;
63- public static readonly Color HorrifiedColor = Calc . HexToColor ( "bc51ff" ) ;
64-
65- private Color colorTo = IdleColor , colorFrom = IdleColor ;
57+ private readonly Color idleColor = Calc . HexToColor ( "0061ff" ) ;
58+ private readonly Color climbedOnColor = Calc . HexToColor ( "ff38f1" ) ;
59+ private readonly Color dashColor = Calc . HexToColor ( "ff0033" ) ;
60+ private readonly Color retractColor = Calc . HexToColor ( "4800ff" ) ;
61+ private readonly Color idleAltColor = Calc . HexToColor ( "00d0ff" ) ;
62+ private readonly Color climbedOnAltColor = Calc . HexToColor ( "f432ff" ) ;
63+ private readonly Color horrifiedColor = Calc . HexToColor ( "bc51ff" ) ;
64+
65+ private Color colorTo = Calc . HexToColor ( "0061ff" ) , colorFrom = Calc . HexToColor ( "0061ff" ) ; // IdleColor
6666 private float colorLerp = 1f ;
6767
6868 public enum FaceState
@@ -108,13 +108,17 @@ public enum FaceState
108108 private readonly List < StaticMover > rightStaticMovers = new ( ) ;
109109
110110 public Lilly ( EntityData data , Vector2 offset )
111- : this ( data . Position + offset , data . Height , data . Int ( "maxLength" ) ) { }
111+ : this ( data . Position + offset , data . Height , data . Int ( "maxLength" ) , data . Attr ( "spriteDir" , "" ) . Trim ( ) . TrimEnd ( '/' ) ,
112+ data . HexColor ( "idleColor" , Calc . HexToColor ( "0061ff" ) ) , data . HexColor ( "climbedOnColor" , Calc . HexToColor ( "ff38f1" ) ) , data . HexColor ( "dashColor" , Calc . HexToColor ( "ff0033" ) ) , data . HexColor ( "retractColor" , Calc . HexToColor ( "4800ff" ) ) ,
113+ data . HexColor ( "idleAltColor" , Calc . HexToColor ( "00d0ff" ) ) , data . HexColor ( "climbedOnAltColor" , Calc . HexToColor ( "f432ff" ) ) , data . HexColor ( "horrifiedColor" , Calc . HexToColor ( "bc51ff" ) ) )
114+ { }
112115
113- public Lilly ( Vector2 position , int height , int maxLength )
116+ public Lilly ( Vector2 position , int height , int maxLength , string spriteDir ,
117+ Color idleColor , Color climbedOnColor , Color dashColor , Color retractColor , Color idleAltColor , Color climbedOnAltColor , Color horrifiedColor )
114118 : base ( position , 24 , height , true )
115119 {
116120 this . SurfaceSoundIndex = SurfaceIndex . CassetteBlock ;
117- this . arm = GFX . Game . GetAtlasSubtextures ( "objects/VortexHelper/squareBumperNew/arm" ) ;
121+ this . arm = GFX . Game . GetAtlasSubtextures ( string . IsNullOrEmpty ( spriteDir ) ? "objects/VortexHelper/squareBumperNew/arm" : spriteDir + " /arm") ;
118122
119123 this . maxLength = Math . Abs ( maxLength ) ;
120124
@@ -125,11 +129,22 @@ public Lilly(Vector2 position, int height, int maxLength)
125129 Position = middle
126130 } ) ;
127131
128- this . face = VortexHelperModule . LillySpriteBank . Create ( "lillyFace" ) ;
132+ this . idleColor = idleColor ;
133+ this . climbedOnColor = climbedOnColor ;
134+ this . dashColor = dashColor ;
135+ this . retractColor = retractColor ;
136+ this . idleAltColor = idleAltColor ;
137+ this . climbedOnAltColor = climbedOnAltColor ;
138+ this . horrifiedColor = horrifiedColor ;
139+ this . colorFrom = this . colorTo = this . idleColor ;
140+
141+ this . face = string . IsNullOrEmpty ( spriteDir ) ? VortexHelperModule . LillySpriteBank . Create ( "lillyFace" ) : BuildCustomFaceSprite ( spriteDir ) ;
129142 this . face . Position = middle + Vector2 . UnitY ;
130- this . face . Color = IdleColor ;
143+ this . face . Color = this . idleColor ;
131144 Add ( this . face ) ;
132145
146+ if ( ! string . IsNullOrEmpty ( spriteDir ) ) InitializeTextures ( spriteDir ) ;
147+
133148 this . OnDashCollide = OnDashed ;
134149
135150 Add ( this . bloom = new BloomPoint ( .65f , 16f )
@@ -139,6 +154,40 @@ public Lilly(Vector2 position, int height, int maxLength)
139154 } ) ;
140155 }
141156
157+ private static Sprite BuildCustomFaceSprite ( string path )
158+ {
159+ Sprite faceSprite = new Sprite ( GFX . Game , path + "/" ) ;
160+
161+ // <Loop id="idle" path="face" frames="0"/>
162+ faceSprite . AddLoop ( "idle" , "face" , 0f , 0 ) ;
163+ // <Anim id="idle_climb" path="face" frames="1-3" delay="0.08"/>
164+ faceSprite . Add ( "idle_climb" , "face" , 0.08f , 1 , 2 , 3 ) ;
165+ // <Anim id="climb_idle" path="face" frames="2,1,0" delay="0.08" goto="idle"/>
166+ faceSprite . Add ( "climb_idle" , "face" , 0.08f , "idle" , 2 , 1 , 0 ) ;
167+
168+ // <Anim id="dashed" path="face" frames="4" delay="0.5" goto="dash"/>
169+ faceSprite . Add ( "dashed" , "face" , 0.5f , "dash" , 4 ) ;
170+ // <Loop id="dash" path="face" frames="5,6" delay="0.08"/>
171+ faceSprite . AddLoop ( "dash" , "face" , 0.08f , 5 , 6 ) ;
172+
173+ // <Anim id="retract" path="face" frames="7-9" delay="0.08"/>
174+ faceSprite . Add ( "retract" , "face" , 0.08f , 7 , 8 , 9 ) ;
175+ // <Anim id="end_retract" path="face" frames="10-12" delay="0.08" goto="idle_alt"/>
176+ faceSprite . Add ( "end_retract" , "face" , 0.08f , "idle_alt" , 10 , 11 , 12 ) ;
177+
178+ // <Loop id="idle_alt" path="face" frames="12" delay="0.08"/>
179+ faceSprite . AddLoop ( "idle_alt" , "face" , 0.08f , 12 ) ;
180+ // <Loop id="climb_alt" path="face" frames="13" delay="0.08"/>
181+ faceSprite . AddLoop ( "climb_alt" , "face" , 0.08f , 13 ) ;
182+
183+ // <Anim id="horrified" path="face" frames="14,15,16,15,16,15,16,15,16,15,16,15,16,17,18,0" delay="0.06"/>
184+ faceSprite . Add ( "horrified" , "face" , 0.06f , 14 , 15 , 16 , 15 , 16 , 15 , 16 , 15 , 16 , 15 , 16 , 15 , 16 , 17 , 18 , 0 ) ;
185+
186+ faceSprite . JustifyOrigin ( 0.5f , 0.5f ) ;
187+ faceSprite . Play ( "idle" ) ;
188+ return faceSprite ;
189+ }
190+
142191 private DashCollisionResults OnDashed ( Player player , Vector2 dir )
143192 {
144193 if ( this . Activated )
@@ -154,7 +203,7 @@ private IEnumerator DashedSequence()
154203 // Dashed in, shaking.
155204 this . faceState = FaceState . Dash ;
156205 this . face . Play ( "dashed" , true ) ;
157- ChangeColor ( DashColor ) ;
206+ ChangeColor ( dashColor ) ;
158207 StartShaking ( 0.375f ) ;
159208 Audio . Play ( CustomSFX . game_lilly_dashed , this . Center ) ;
160209 yield return 0.5f ;
@@ -236,7 +285,7 @@ private IEnumerator DashedSequence()
236285 this . faceState = FaceState . Retract ;
237286 this . face . Play ( "retract" ) ;
238287 this . sfx . Play ( CustomSFX . game_lilly_conveyor , "end" , 0f ) ;
239- ChangeColor ( RetractColor ) ;
288+ ChangeColor ( retractColor ) ;
240289
241290 float retractFactor = 0f ;
242291 while ( rightArmExtended || leftArmExtended )
@@ -293,7 +342,7 @@ private IEnumerator DashedSequence()
293342 this . sfx . Param ( "end" , 1f ) ;
294343 this . faceState = FaceState . IdleAlt ;
295344 this . face . Play ( "end_retract" ) ;
296- ChangeColor ( IdleAltColor ) ;
345+ ChangeColor ( idleAltColor ) ;
297346
298347 this . armsExtended = false ;
299348 RemoveArms ( rightArmEnd , rightArm ) ;
@@ -333,7 +382,7 @@ private void UpdateFace()
333382 {
334383 this . faceState = FaceState . Horrified ;
335384 this . face . Play ( "horrified" ) ;
336- ChangeColor ( HorrifiedColor ) ;
385+ ChangeColor ( horrifiedColor ) ;
337386 }
338387
339388 if ( this . Activated || this . faceState == FaceState . Horrified )
@@ -344,25 +393,25 @@ private void UpdateFace()
344393 {
345394 this . faceState = FaceState . ClimbedOn ;
346395 this . face . Play ( "idle_climb" ) ;
347- ChangeColor ( ClimbedOnColor ) ;
396+ ChangeColor ( climbedOnColor ) ;
348397 }
349398 else if ( ! ridden && this . faceState == FaceState . ClimbedOn )
350399 {
351400 this . faceState = FaceState . Idle ;
352401 this . face . Play ( "climb_idle" ) ;
353- ChangeColor ( IdleColor ) ;
402+ ChangeColor ( idleColor ) ;
354403 }
355404 else if ( ridden && this . faceState == FaceState . IdleAlt )
356405 {
357406 this . faceState = FaceState . ClimbedOnAlt ;
358407 this . face . Play ( "climb_alt" ) ;
359- ChangeColor ( ClimbedOnAltColor ) ;
408+ ChangeColor ( climbedOnAltColor ) ;
360409 }
361410 else if ( ! ridden && this . faceState == FaceState . ClimbedOnAlt )
362411 {
363412 this . faceState = FaceState . IdleAlt ;
364413 this . face . Play ( "idle_alt" ) ;
365- ChangeColor ( IdleAltColor ) ;
414+ ChangeColor ( idleAltColor ) ;
366415 }
367416 }
368417
@@ -465,13 +514,13 @@ public override void Render()
465514 this . Position = pos ;
466515 }
467516
468- public static void InitializeTextures ( )
517+ public static void InitializeTextures ( string path = "objects/VortexHelper/squareBumperNew" )
469518 {
470- MTexture block00 = GFX . Game [ "objects/VortexHelper/squareBumperNew /block00"] ;
471- MTexture block01 = GFX . Game [ "objects/VortexHelper/squareBumperNew /block01"] ;
472- MTexture active_block00 = GFX . Game [ "objects/VortexHelper/squareBumperNew /active_block00"] ;
473- MTexture active_block01 = GFX . Game [ "objects/VortexHelper/squareBumperNew /active_block01"] ;
474- MTexture armend = GFX . Game [ "objects/VortexHelper/squareBumperNew /armend"] ;
519+ MTexture block00 = GFX . Game [ path + " /block00"] ;
520+ MTexture block01 = GFX . Game [ path + " /block01"] ;
521+ MTexture active_block00 = GFX . Game [ path + " /active_block00"] ;
522+ MTexture active_block01 = GFX . Game [ path + " /active_block01"] ;
523+ MTexture armend = GFX . Game [ path + " /armend"] ;
475524
476525 for ( int j = 0 ; j < 4 ; j ++ )
477526 {
0 commit comments