void UpdateCavePosition() { if (layerGridGraph != null && PeCreature.Instance.mainPlayer != null) { PeEntity mainPlayer = PeCreature.Instance.mainPlayer; Vector2 v2 = new Vector2(mainPlayer.position.x, mainPlayer.position.z); //Vector2 center, size; //if(CaveData.GetCenter(v2, out center, out size)) //{ // Vector3 v = new Vector3(center.x, 0.0f, center.y); // Vector3 d = v - layerGridGraph.center; // if(d != Vector3.zero) // { // layerGridGraph.center += d; // layerGridGraph.GenerateMatrix(); // } // int width = (int)size.x; // int depth = (int)size.y; // if(layerGridGraph.width != width || layerGridGraph.depth != depth) // { // layerGridGraph.width = width; // layerGridGraph.depth = depth; // layerGridGraph.UpdateSizeFromWidthDepth(); // } //} CaveData data = CaveData.Get(v2); if (data != null) { Vector3 v3 = new Vector3(data.center.x, 0.0f, data.center.y); Vector3 dir = v3 - layerGridGraph.center; if (dir != Vector3.zero) { layerGridGraph.center += dir; layerGridGraph.GenerateMatrix(); } } } }