Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //MD5Hash:09cfaae5eec50d28cc5b2570f73f4d51;
- 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;
- 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));
- }
- }
- }
- void Update()
- {
- UnityEngine.Ray Ray;
- UnityEngine.RaycastHit Hit;
- Camera_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition);
- Ray = Camera_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition);
- UnityEngine.Physics.Raycast(Ray, out Hit);
- if (UnityEngine.Physics.Raycast(Ray, out Hit))
- {
- UnityEngine.Debug.Log(Hit.collider.gameObject.transform.root.gameObject.name);
- }
- }
- }
Add Comment
Please, Sign In to add comment