@@ -104,7 +104,7 @@ public class Scene implements Serializable, AssetConsumer {
104
104
private final TextManager textManager ;
105
105
106
106
private World w ;
107
-
107
+
108
108
/** The current walkzone actor */
109
109
private String walkZone ;
110
110
@@ -299,7 +299,7 @@ public void drawBBoxLines(ShapeRenderer renderer) {
299
299
300
300
public BaseActor getActor (String id , boolean searchInventory ) {
301
301
302
- if (VAR_PLAYER .equals (id ))
302
+ if (VAR_PLAYER .equals (id ) && player != null )
303
303
return actors .get (player );
304
304
305
305
BaseActor a = id == null ? null : actors .get (id );
@@ -579,11 +579,11 @@ public SpriteActor getCameraFollowActor() {
579
579
public SceneSoundManager getSoundManager () {
580
580
return soundManager ;
581
581
}
582
-
582
+
583
583
public void calcWalkzone () {
584
584
if (walkZone != null ) {
585
585
polygonalNavGraph .createInitialGraph (actors .get (walkZone ), actors .values ());
586
- }
586
+ }
587
587
}
588
588
589
589
@ Override
@@ -604,7 +604,7 @@ public void loadAssets() {
604
604
// CALC WALK GRAPH
605
605
calcWalkzone ();
606
606
}
607
-
607
+
608
608
@ Override
609
609
public void retrieveAssets () {
610
610
@@ -737,7 +737,7 @@ public void write(Json json) {
737
737
738
738
if (player != null )
739
739
json .writeValue ("player" , player );
740
-
740
+
741
741
json .writeValue ("walkZone" , walkZone );
742
742
}
743
743
@@ -771,29 +771,29 @@ public void read(Json json, JsonValue jsonData) {
771
771
musicDesc = json .readValue ("musicDesc" , MusicDesc .class , jsonData );
772
772
773
773
depthVector = json .readValue ("depthVector" , Vector2 .class , jsonData );
774
-
775
- if (jsonData .get ("polygonalNavGraph" ) != null ) {
776
-
774
+
775
+ if (jsonData .get ("polygonalNavGraph" ) != null ) {
776
+
777
777
JsonValue jsonValuePNG = jsonData .get ("polygonalNavGraph" );
778
-
778
+
779
779
float worldScale = EngineAssetManager .getInstance ().getScale ();
780
780
781
781
Polygon walkZonePol = json .readValue ("walkZone" , Polygon .class , jsonValuePNG );
782
782
walkZonePol .setScale (worldScale , worldScale );
783
783
walkZonePol .setPosition (walkZonePol .getX () * worldScale , walkZonePol .getY () * worldScale );
784
-
784
+
785
785
WalkZoneActor wz = new WalkZoneActor ();
786
786
wz .setId ("walkzone" );
787
787
wz .bbox .setVertices (walkZonePol .getVertices ());
788
788
wz .bbox .setScale (walkZonePol .getScaleX (), walkZonePol .getScaleY ());
789
- wz .bbox .setPosition (walkZonePol .getX (), walkZonePol .getY ());
789
+ wz .bbox .setPosition (walkZonePol .getX (), walkZonePol .getY ());
790
790
wz .setScene (this );
791
791
wz .setInitScene (id );
792
-
792
+
793
793
actors .put (wz .getId (), wz );
794
794
walkZone = wz .getId ();
795
795
}
796
-
796
+
797
797
sceneSize = json .readValue ("sceneSize" , Vector2 .class , jsonData );
798
798
799
799
} else {
@@ -849,8 +849,8 @@ public void read(Json json, JsonValue jsonData) {
849
849
verbs .read (json , jsonData );
850
850
state = json .readValue ("state" , String .class , jsonData );
851
851
player = json .readValue ("player" , String .class , jsonData );
852
-
853
- if (jsonData .get ("walkZone" ) != null )
852
+
853
+ if (jsonData .get ("walkZone" ) != null )
854
854
walkZone = json .readValue ("walkZone" , String .class , jsonData );
855
855
}
856
856
}
0 commit comments