示例#1
0
    /// <summary>
    /// Moves all the building to the new spot
    /// </summary>
    /// <param name="randIniPos"></param>
    /// <param name="bData"></param>
    private static void MoveAllBuildingsToNewSpot(BuildingData bData, Vector3 spot, List <Vector3> list)
    {
        difference = spot - UPoly.MiddlePoint(list);

        for (int i = 0; i < bData.All.Count; i++)
        {
            var newPos = bData.All[i].IniPos + difference;
            //its is important to get the newPOs in the closest vertex so is aling with new buildings to
            //spawn by user
            //newPos = m.Vertex.FindClosestVertex(newPos, m.AllVertexs.ToArray());
            bData.All[i].IniPos = newPos;
        }
    }