@@ -70,6 +70,7 @@ public NPCCache(string npc, TextAsset asset)
7070 bool collisionRenderFlag = false ;
7171 bool talkVolumeRenderFlag = false ;
7272 public bool CamEventReset { get ; private set ; } = false ;
73+ private bool camEventsFound = false ;
7374
7475 public void Awake ( )
7576 {
@@ -228,6 +229,8 @@ public void ToggleState(bool enabled, PlayerMachine playerMachine)
228229 collisionRenderFlag = false ;
229230 collPlaneCache . UpdateCache ( VoidOutCreator , collisionRenderFlag ) ;
230231
232+ camEventsFound = FindObjectsOfType < HiddenPlatform > ( ) . Length > 0 ;
233+
231234 if ( go )
232235 {
233236 bossController = go . GetComponent < BossRoomController > ( ) . Boss ;
@@ -297,18 +300,21 @@ public void Update()
297300 GameObject . FindGameObjectWithTag ( "Manager" ) . GetComponent < DialogueSystem > ( ) . UpdateCostumePortrait ( ) ;
298301 }
299302
300- if ( Input . GetKeyDown ( KeyCode . Comma ) )
301- {
302- if ( -- currentNpcIdx < 0 )
303- currentNpcIdx = dialogueCache . Count - 1 ;
304- }
305- else if ( Input . GetKeyDown ( KeyCode . Period ) )
303+ if ( dialogueCache . Count > 0 )
306304 {
307- currentNpcIdx = ( currentNpcIdx + 1 ) % dialogueCache . Count ;
308- }
309- else if ( Input . GetKeyDown ( KeyCode . F3 ) )
310- {
311- GameObject . FindGameObjectWithTag ( "Manager" ) . GetComponent < DialogueSystem > ( ) . Begin ( dialogueCache [ currentNpcIdx ] . TextAsset , null ) ;
305+ if ( Input . GetKeyDown ( KeyCode . Comma ) )
306+ {
307+ if ( -- currentNpcIdx < 0 )
308+ currentNpcIdx = dialogueCache . Count - 1 ;
309+ }
310+ else if ( Input . GetKeyDown ( KeyCode . Period ) )
311+ {
312+ currentNpcIdx = ( currentNpcIdx + 1 ) % dialogueCache . Count ;
313+ }
314+ else if ( Input . GetKeyDown ( KeyCode . F3 ) )
315+ {
316+ GameObject . FindGameObjectWithTag ( "Manager" ) . GetComponent < DialogueSystem > ( ) . Begin ( dialogueCache [ currentNpcIdx ] . TextAsset , null ) ;
317+ }
312318 }
313319
314320 if ( Input . GetKeyDown ( KeyCode . F4 ) || Input . GetKeyDown ( KeyCode . Keypad4 ) )
@@ -464,15 +470,18 @@ public void Update()
464470 bool ? b = PlayerMachine . CoyoteFrameEnabled ;
465471
466472 textBuilder . Length = 0 ;
473+
467474 textBuilder . AppendFormat ( "FPS: {0:F3}\n " , 1f / deltaTime ) ;
468475 textBuilder . AppendFormat ( "<F1>: Coyote Frames: {0}\n " , b . HasValue ? OnOffStr ( b . Value ) : "Default" ) ;
469476 textBuilder . Append ( "<F2><[]>: Set Costume: " ) . AppendLine ( costumeNames [ currentCostIdx ] ) ;
470- textBuilder . AppendFormat ( "<F3><,.>: Dialogue: " ) . AppendLine ( dialogueCache [ currentNpcIdx ] . NpcName ) ;
477+ if ( dialogueCache . Count > 0 )
478+ textBuilder . AppendFormat ( "<F3><,.>: Dialogue: " ) . AppendLine ( dialogueCache [ currentNpcIdx ] . NpcName ) ;
471479 textBuilder . Append ( "<F4>: Time Scale: x" ) . AppendLine ( Time . timeScale . ToString ( "F2" ) ) ;
472480 textBuilder . Append ( "<F5>: Text Storage/Warp\n " ) ;
473481 textBuilder . AppendFormat ( "<F6>: VSync Count :{0}\n " , QualitySettings . vSyncCount ) ;
474482 textBuilder . AppendFormat ( "<F7><L>: Level Load: {0}\n " , ! inVoid ? "void" : levelNames [ currentLvlIdx ] ) ;
475- textBuilder . AppendFormat ( "<F8>: Repeat Cam Events: {0}\n " , OnOffStr ( CamEventReset ) ) ;
483+ if ( camEventsFound )
484+ textBuilder . AppendFormat ( "<F8>: Repeat Cam Events: {0}\n " , OnOffStr ( CamEventReset ) ) ;
476485 textBuilder . Append ( "<V>: Render Death Planes: " ) . AppendLine ( OnOffStr ( collisionRenderFlag ) ) ;
477486 textBuilder . Append ( "<M>: Active Death Planes: " ) . AppendLine ( OnOffStr ( deathPlaneStatus ) ) ;
478487 textBuilder . Append ( "<G>: Show NPC Talk Zone: " ) . AppendLine ( OnOffStr ( talkVolumeRenderFlag ) ) ;
@@ -506,7 +515,8 @@ public void Update()
506515
507516 }
508517
509- textComp . SetText ( textBuilder ) ;
518+ // Set text causes visual glitches
519+ textComp . text += textBuilder . ToString ( ) ;
510520 }
511521 }
512522}
0 commit comments