Example #1
0
        public HexColumnRenderer(int x, HexGrid hexGrid, Transform MeshPart)
        {
            this.MapData = hexGrid.MapData;

            Column = new GameObject("Column " + x, typeof(MeshRenderer), typeof(MeshFilter));
            Column.transform.parent = MeshPart;

            UpdateColumn(x);
        }
Example #2
0
        public HexGridColiderer(HexGrid hexGrid, int indexOfLayer)
        {
            SurfaceLayer = 1 << indexOfLayer;

            this.MapData = hexGrid.MapData;

            ColiderPart = new GameObject("Colider Part");
            ColiderPart.transform.parent = hexGrid.transform;

            Coliders = new List <GameObject>();
            ReUpdateAllColiders();
        }
Example #3
0
        public HexGridRenderer(HexGrid hexGrid)
        {
            this.MapData       = hexGrid.MapData;
            hexColumnRenderers = new HexColumnRenderer[MapData.width];

            GameObject MeshPart = new GameObject("Mesh Part", typeof(NavMeshSurface));

            MeshPart.transform.parent = hexGrid.transform;

            for (int x = 0; x < MapData.width; x++)
            {
                InitColumn(x, hexGrid, MeshPart.transform);
            }

            MeshPart.GetComponent <NavMeshSurface>().BuildNavMesh();
        }
Example #4
0
        private void Awake()
        {
            MapData = XMLMapLoader.MapLoadXMLFile(DefMapPath)[0];

            InitWorld();
        }
Example #5
0
        public static Vector3 CalcCenterCoordXZFromHexCoordXZ(Vector3 hexCoord, HexGridData MapData)
        {
            Vector3 CenterCoord = new Vector3(hexCoord.x * 2 * innerRadius * MapData.cellSize + hexCoord.z % 2 * innerRadius * MapData.cellSize, MapData.HeightMap[(int)hexCoord.z * MapData.width + (int)hexCoord.x], hexCoord.z * 1.5f * MapData.cellSize * outerRadius);

            return(CenterCoord);
        }