Advertisement
diegographics

Untitled

Apr 4th, 2017
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.68 KB | None | 0 0
  1. //MD5Hash:1c13b9ff8457861cd7147f84720cfdd3;
  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.         CameraCenter(XY_Cordinates);
  29.         for (int i_268 = 0; i_268 < Count_X; i_268++)
  30.         {
  31.             X_Position = (i_268 * XY_Cordinates);
  32.             Index_X = i_268;
  33.             for (int i_271 = 0; i_271 < Count_Y; i_271++)
  34.             {
  35.                 Y_Position = (i_271 * XY_Cordinates);
  36.                 Index_Y = i_271;
  37.                 if (((Count_Y - 1) == i_271))
  38.                 {
  39.                     GameObject_GroundPlaneContainer.name = "Plane_X_" + Index_X.ToString() + "_Y_" + Index_Y.ToString();
  40.                     UnityEngine.Object.Instantiate(GameObject_GroundPlaneContainer, new UnityEngine.Vector3(X_Position, Y_Position, 0f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f));
  41.                 }
  42.                 else
  43.                 {
  44.                     GameObject_Plane.name = "Plane_X_" + Index_X.ToString() + "_Y_" + Index_Y.ToString();
  45.                     UnityEngine.Object.Instantiate(GameObject_Plane, new UnityEngine.Vector3(X_Position, Y_Position, 0f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f));
  46.                 }
  47.  
  48.             }
  49.         }
  50.         for (int i_313 = 0; i_313 < Count_X; i_313++)
  51.         {
  52.             Depth_Position_X = (i_313 * XY_Cordinates);
  53.             for (int i_315 = 0; i_315 < Count_Depth_X; i_315++)
  54.             {
  55.                 Depth_Position_Z = (i_315 * XY_Cordinates);
  56.                 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));
  57.             }
  58.         }
  59.         InitialVault(XY_Cordinates);
  60.     }
  61.     void Update()
  62.     {
  63.         UnityEngine.Ray Ray;
  64.         UnityEngine.RaycastHit Hit;
  65.  
  66.         ///Mouse Hover Debug function
  67.         Camera_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition);
  68.         ///Mouse Hover Debug function
  69.         Ray = Camera_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition);
  70.         ///Mouse Hover Debug function
  71.         UnityEngine.Physics.Raycast(Ray, out Hit);
  72.         ///Mouse Hover Debug function
  73.         if (UnityEngine.Physics.Raycast(Ray, out Hit))
  74.         {
  75.             ///Mouse Hover Debug function
  76.             if (UnityEngine.Input.GetMouseButtonDown(0))
  77.             {
  78.                 UnityEngine.Debug.Log(Hit.collider.gameObject.transform.root.gameObject.name);
  79.             }
  80.  
  81.         }
  82.  
  83.     }
  84.     public void CameraCenter(int XY_Cordinates)
  85.     {
  86.         var _TempVar_410_1 = Camera_MainCamera.transform;
  87.         var _TempVar_417_2 = _TempVar_410_1.position;
  88.         _TempVar_410_1.position = new UnityEngine.Vector3(((Count_X / 2) * XY_Cordinates), _TempVar_417_2.y, _TempVar_417_2.z);
  89.     }
  90.     public void InitialVault(int XY_Position)
  91.     {
  92.     }
  93.     public void Room_Place(int X_Index, int Y_Index, int XY_Position, string Room_Identifier)
  94.     {
  95.         UnityEngine.GameObject.Find("Plane_X_" + X_Index.ToString() + "_Y_" + Y_Index.ToString() + "(Clone)");
  96.         UnityEngine.GameObject.Find("Plane_X_" + X_Index.ToString() + "_Y_" + Y_Index.ToString() + "(Clone)").SetActive(false);
  97.         UnityEngine.Resources.Load("Rooms/" + Room_Identifier).name = "Plane_X_" + "_Y_";
  98.         UnityEngine.Object.Instantiate(UnityEngine.Resources.Load("Rooms/" + Room_Identifier), new UnityEngine.Vector3((X_Index * XY_Position), (Y_Index * XY_Position), -5f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f));
  99.     }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement