@@ -20,7 +20,9 @@ class PracticeModManager : MonoBehaviour
2020 public GameObject flashLight ;
2121 public CharacterMotor playerMotor ;
2222 public Camera playerCamera ;
23+ public ResizeScript resizeScript ;
2324 public Text playerText ;
25+ public Text grabbedObejctText ;
2426
2527
2628 Vector3 storedPosition ;
@@ -72,6 +74,7 @@ void Update()
7274 player = GameManager . GM . player ;
7375 playerMotor = player . GetComponent < CharacterMotor > ( ) ;
7476 playerCamera = player . GetComponentInChildren < Camera > ( ) ;
77+ resizeScript = playerCamera . GetComponent < ResizeScript > ( ) ;
7578 defaultFarClipPlane = playerCamera . farClipPlane ;
7679 if ( player . transform . Find ( "Flashlight" ) == null )
7780 {
@@ -92,6 +95,12 @@ void Update()
9295 {
9396 playerText = NewPlayerText ( ) ;
9497 }
98+
99+ if ( GameObject . Find ( "GrabbedObjectText" ) == null && GameObject . Find ( "UI_PAUSE_MENU" ) != null )
100+ {
101+ grabbedObejctText = NewGrabbedObjectText ( ) ;
102+ }
103+
95104 GameManager . GM . enableDebugFunctions = debugFunctions ;
96105 }
97106
@@ -139,6 +148,11 @@ void Update()
139148 playerText . text = GetPlayerTextString ( ) ;
140149 }
141150
151+ if ( grabbedObejctText != null )
152+ {
153+ grabbedObejctText . text = GetGrabbedObjectTextString ( ) ;
154+ }
155+
142156 if ( Input . GetKey ( KeyCode . F1 ) )
143157 {
144158 float newScale = playerMotor . transform . localScale . x + Time . deltaTime * playerMotor . transform . localScale . x ;
@@ -211,6 +225,34 @@ Text NewPlayerText()
211225 return newText ;
212226 }
213227
228+ Text NewGrabbedObjectText ( )
229+ {
230+ Text newText ;
231+ GameObject gameObject = new GameObject ( "GrabbedObjectText" ) ;
232+ gameObject . transform . parent = GameObject . Find ( "UI_PAUSE_MENU" ) . transform . Find ( "Canvas" ) ;
233+ gameObject . AddComponent < CanvasGroup > ( ) . interactable = false ;
234+ newText = gameObject . AddComponent < Text > ( ) ;
235+ RectTransform component = newText . GetComponent < RectTransform > ( ) ;
236+ component . sizeDelta = new Vector2 ( ( float ) ( Screen . currentResolution . width / 3 ) , ( float ) ( Screen . currentResolution . height / 3 ) ) ;
237+ component . pivot = new Vector2 ( 0f , .5f ) ;
238+ component . anchorMin = new Vector2 ( 0f , .5f ) ;
239+ component . anchorMax = new Vector2 ( 0f , .5f ) ;
240+ component . anchoredPosition = new Vector2 ( 25f , - 25f ) ;
241+ foreach ( Font font in Resources . FindObjectsOfTypeAll < Font > ( ) )
242+ {
243+ if ( font . name == "BebasNeue Bold" )
244+ {
245+ newText . font = font ;
246+ }
247+ }
248+ newText . text = "hello world" ;
249+ newText . fontSize = 30 ;
250+
251+ return newText ;
252+ }
253+
254+
255+
214256 string GetPlayerTextString ( )
215257 {
216258 Vector3 position = playerMotor . transform . localPosition ;
@@ -248,11 +290,9 @@ string GetPlayerTextString()
248290 position . z . ToString ( "0.000" ) ,
249291 "\n " ,
250292 "Rotation: " ,
251- playerCamera . transform . rotation . x . ToString ( "0.000" ) ,
293+ playerCamera . transform . rotation . eulerAngles . x . ToString ( "0.000" ) ,
252294 ", " ,
253295 rotation . y . ToString ( "0.000" ) ,
254- ", " ,
255- rotation . z . ToString ( "0.000" ) ,
256296 "\n " ,
257297 "Scale: " ,
258298 scale . ToString ( "0.0000" ) + "x" ,
@@ -265,8 +305,23 @@ string GetPlayerTextString()
265305 "\n " ,
266306 dynamicInfo
267307 } ) ;
308+ }
268309
269-
310+ string GetGrabbedObjectTextString ( )
311+ {
312+ if ( resizeScript . isGrabbing && resizeScript . GetGrabbedObject ( ) != null )
313+ {
314+ GameObject grabbedObject = resizeScript . GetGrabbedObject ( ) ;
315+ return string . Concat ( new object [ ] {
316+ grabbedObject . name + "\n " ,
317+ "Position: " + grabbedObject . transform . position . x . ToString ( "0.000" ) + ", " + grabbedObject . transform . position . y . ToString ( "0.000" ) + ", " + grabbedObject . transform . position . z . ToString ( "0.000" ) + "\n " ,
318+ "Scale: " + grabbedObject . transform . localScale . x . ToString ( "0.0000" ) + "x"
319+ } ) ;
320+ }
321+ else
322+ {
323+ return "" ;
324+ }
270325 }
271326
272327 void StorePosition ( )
0 commit comments