Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //MD5Hash:1c13b9ff8457861cd7147f84720cfdd3;
- using UnityEngine;
- using System;
- public class MapGenerator : UnityEngine.MonoBehaviour
- {
- public UnityEngine.GameObject GameObject_Plane = null;
- public UnityEngine.GameObject GameObject_GroundPlaneContainer = null;
- public UnityEngine.GameObject GameObject_DesertPlaneContainer = null;
- public int Count_X = 0;
- public int Count_Y = 0;
- public int Count_Depth_X = 0;
- public UnityEngine.Camera Camera_MainCamera = null;
- void Start()
- {
- int X_Position = 0;
- int Y_Position = 0;
- int XY_Cordinates = 10;
- int Depth_Position_X = 0;
- int Depth_Position_Z = 0;
- int Half_Divider = 2;
- int Index_X = 0;
- int Index_Y = 0;
- CameraCenter(XY_Cordinates);
- for (int i_268 = 0; i_268 < Count_X; i_268++)
- {
- X_Position = (i_268 * XY_Cordinates);
- Index_X = i_268;
- for (int i_271 = 0; i_271 < Count_Y; i_271++)
- {
- Y_Position = (i_271 * XY_Cordinates);
- Index_Y = i_271;
- if (((Count_Y - 1) == i_271))
- {
- GameObject_GroundPlaneContainer.name = "Plane_X_" + Index_X.ToString() + "_Y_" + Index_Y.ToString();
- UnityEngine.Object.Instantiate(GameObject_GroundPlaneContainer, new UnityEngine.Vector3(X_Position, Y_Position, 0f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f));
- }
- else
- {
- GameObject_Plane.name = "Plane_X_" + Index_X.ToString() + "_Y_" + Index_Y.ToString();
- UnityEngine.Object.Instantiate(GameObject_Plane, new UnityEngine.Vector3(X_Position, Y_Position, 0f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f));
- }
- }
- }
- for (int i_313 = 0; i_313 < Count_X; i_313++)
- {
- Depth_Position_X = (i_313 * XY_Cordinates);
- for (int i_315 = 0; i_315 < Count_Depth_X; i_315++)
- {
- Depth_Position_Z = (i_315 * XY_Cordinates);
- 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));
- }
- }
- InitialVault(XY_Cordinates);
- }
- void Update()
- {
- UnityEngine.Ray Ray;
- UnityEngine.RaycastHit Hit;
- ///Mouse Hover Debug function
- Camera_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition);
- ///Mouse Hover Debug function
- Ray = Camera_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition);
- ///Mouse Hover Debug function
- UnityEngine.Physics.Raycast(Ray, out Hit);
- ///Mouse Hover Debug function
- if (UnityEngine.Physics.Raycast(Ray, out Hit))
- {
- ///Mouse Hover Debug function
- if (UnityEngine.Input.GetMouseButtonDown(0))
- {
- UnityEngine.Debug.Log(Hit.collider.gameObject.transform.root.gameObject.name);
- }
- }
- }
- public void CameraCenter(int XY_Cordinates)
- {
- var _TempVar_410_1 = Camera_MainCamera.transform;
- var _TempVar_417_2 = _TempVar_410_1.position;
- _TempVar_410_1.position = new UnityEngine.Vector3(((Count_X / 2) * XY_Cordinates), _TempVar_417_2.y, _TempVar_417_2.z);
- }
- public void InitialVault(int XY_Position)
- {
- }
- public void Room_Place(int X_Index, int Y_Index, int XY_Position, string Room_Identifier)
- {
- UnityEngine.GameObject.Find("Plane_X_" + X_Index.ToString() + "_Y_" + Y_Index.ToString() + "(Clone)");
- UnityEngine.GameObject.Find("Plane_X_" + X_Index.ToString() + "_Y_" + Y_Index.ToString() + "(Clone)").SetActive(false);
- UnityEngine.Resources.Load("Rooms/" + Room_Identifier).name = "Plane_X_" + "_Y_";
- 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));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement