@@ -36,6 +36,7 @@ public void Awake()
3636 Log . Init ( Logger ) ;
3737
3838 GlobalEventManager . onCharacterDeathGlobal += OnCharacterDeath ;
39+ GlobalEventManager . OnInteractionsGlobal += ( x , y , z ) => ScanScene ( ) ;
3940 }
4041
4142 private void OnCharacterDeath ( object o )
@@ -51,23 +52,39 @@ private void Update()
5152 if ( Input . GetKeyDown ( KeyCode . M ) )
5253 {
5354 Enable = ! Enable ;
55+
56+ if ( Enable == false )
57+ {
58+ Reset ( ) ;
59+ }
5460 }
5561
5662 if ( Enable )
5763 {
58- Log . LogInfo ( $ "Minimap Created({ Minimap . Created } )") ;
59-
6064 if ( Minimap . Created )
6165 {
62- Minimap . SetRotation ( Camera . main . transform . rotation ) ;
66+ if ( Camera . main == null )
67+ {
68+ Reset ( ) ;
69+ return ;
70+ }
71+
72+ try
73+ {
74+ Minimap . SetRotation ( Camera . main . transform . rotation ) ;
75+ }
76+ catch ( NullReferenceException )
77+ {
78+ Reset ( ) ;
79+ return ;
80+ }
6381
6482 for ( int i = 0 ; i < TrackedObjects . Count ; i ++ )
6583 {
6684 var item = TrackedObjects [ i ] ;
6785
6886 if ( item . MinimapTransform == null )
6987 {
70- Log . LogInfo ( $ "Created icon for { item . gameObject . name } ") ;
7188 item . MinimapTransform = Minimap . CreateIcon ( item . InteractableType , WorldToMinimap ( item . gameObject . transform . position ) - WorldToMinimap ( Camera . main . transform . position ) , this . SpriteManager ) ;
7289 }
7390 else
@@ -103,6 +120,13 @@ private void Update()
103120 }
104121 }
105122
123+ private void Reset ( )
124+ {
125+ TrackedObjects . Clear ( ) ;
126+ ResetGlobalDimensions ( ) ;
127+ Minimap . Destroy ( ) ;
128+ }
129+
106130 private void ScanScene ( )
107131 {
108132 ResetGlobalDimensions ( ) ;
@@ -129,6 +153,10 @@ private void ScanScene()
129153
130154 RegisterTypes ( typeof ( BarrelInteraction ) , InteractableKind . Utility ) ;
131155
156+ RegisterTypes ( typeof ( ScrapperController ) , InteractableKind . Utility ) ;
157+
158+ RegisterTypes ( typeof ( GenericInteraction ) , InteractableKind . Special ) ;
159+
132160 // set the values used to calculate the scaled positions in the minimap for the items
133161
134162 // at this point the global mins and maxes are set determine the differences
0 commit comments