Advertisement
diegographics

Untitled

Apr 3rd, 2017
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. //MD5Hash:09cfaae5eec50d28cc5b2570f73f4d51;
  2. using UnityEngine;
  3. using System;
  4.  
  5.  
  6. public class MapGenerator : UnityEngine.MonoBehaviour
  7. {
  8. public UnityEngine.GameObject GameObject_Plane = null;
  9. public UnityEngine.GameObject GameObject_GroundPlaneContainer = null;
  10. public UnityEngine.GameObject GameObject_DesertPlaneContainer = null;
  11. public int Count_X = 0;
  12. public int Count_Y = 0;
  13. public int Count_Depth_X = 0;
  14. public UnityEngine.Camera Camera_MainCamera = null;
  15.  
  16.  
  17. void Start()
  18. {
  19. int X_Position = 0;
  20. int Y_Position = 0;
  21. int XY_Cordinates = 10;
  22. int Depth_Position_X = 0;
  23. int Depth_Position_Z = 0;
  24. int Half_Divider = 2;
  25. int Index_X = 0;
  26. int Index_Y = 0;
  27.  
  28. for (int i_268 = 0; i_268 < Count_X; i_268++)
  29. {
  30. X_Position = (i_268 * XY_Cordinates);
  31. Index_X = i_268;
  32. for (int i_271 = 0; i_271 < Count_Y; i_271++)
  33. {
  34. Y_Position = (i_271 * XY_Cordinates);
  35. Index_Y = i_271;
  36. if (((Count_Y - 1) == i_271))
  37. {
  38. GameObject_GroundPlaneContainer.name = "Plane_X_" + Index_X.ToString() + "_Y_" + Index_Y.ToString();
  39. UnityEngine.Object.Instantiate(GameObject_GroundPlaneContainer, new UnityEngine.Vector3(X_Position, Y_Position, 0f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f));
  40. }
  41. else
  42. {
  43. GameObject_Plane.name = "Plane_X_" + Index_X.ToString() + "_Y_" + Index_Y.ToString();
  44. UnityEngine.Object.Instantiate(GameObject_Plane, new UnityEngine.Vector3(X_Position, Y_Position, 0f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f));
  45. }
  46.  
  47. }
  48. }
  49. for (int i_313 = 0; i_313 < Count_X; i_313++)
  50. {
  51. Depth_Position_X = (i_313 * XY_Cordinates);
  52. for (int i_315 = 0; i_315 < Count_Depth_X; i_315++)
  53. {
  54. Depth_Position_Z = (i_315 * XY_Cordinates);
  55. UnityEngine.Object.Instantiate(GameObject_DesertPlaneContainer, new UnityEngine.Vector3(Depth_Position_X, ((Count_Y * XY_Cordinates) - (XY_Cordinates / Half_Divider)), (Depth_Position_Z + ((XY_Cordinates / Half_Divider) - (Count_Depth_X * XY_Cordinates)))), new UnityEngine.Quaternion(0f, 0f, 0f, 0f));
  56. }
  57. }
  58. }
  59. void Update()
  60. {
  61. UnityEngine.Ray Ray;
  62. UnityEngine.RaycastHit Hit;
  63.  
  64. Camera_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition);
  65. Ray = Camera_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition);
  66. UnityEngine.Physics.Raycast(Ray, out Hit);
  67. if (UnityEngine.Physics.Raycast(Ray, out Hit))
  68. {
  69. UnityEngine.Debug.Log(Hit.collider.gameObject.transform.root.gameObject.name);
  70. }
  71.  
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement