/// <summary> /// Add a new Location object and script to the scene. Append the location /// </summary> /// <param name="landscape"></param> /// <param name="lbGroupLocation"></param> /// <param name="showErrors"></param> /// <returns></returns> public static LBGroupLocationItem AddNewLocationToScene(LBLandscape landscape, LBGroup lbGroupLocation, Vector2 mousePosition, Camera svCamera, bool showErrors) { LBGroupLocationItem lbGroupLocationItem = null; string methodName = "LBGroupLocationItem.AddNewLocationToScene"; // Basic validation if (landscape == null) { if (showErrors) { Debug.LogWarning("ERROR: " + methodName + " landscape is null"); } } else if (lbGroupLocation == null) { if (showErrors) { Debug.LogWarning("ERROR: " + methodName + " lbGroupLocation is null"); } } else { Vector3 locationPoint = Vector3.zero; locationPoint = LBEditorHelper.GetLandscapePositionFromMouse(landscape, mousePosition, false, true); if (locationPoint.x != 0 && locationPoint.z != 0) { //Debug.Log("[DEBUG] locationPoint " + locationPoint + " mousePos: " + mousePosition); Material locationMaterial = null; locationMaterial = LBEditorHelper.GetMaterialFromAssets(LBSetup.materialsFolder, "LBLocation.mat"); lbGroupLocationItem = CreateLocationItemInScene(landscape, lbGroupLocation, locationMaterial, locationPoint, 0f, lbGroupLocation.positionList.Count + 1, showErrors); if (lbGroupLocationItem != null) { lbGroupLocationItem.lbGroup.positionList.Add(locationPoint - landscape.start); if (lbGroupLocationItem.lbGroup.isFixedRotation) { lbGroupLocationItem.lbGroup.rotationYList.Add(0f); } LBEditorHelper.RepaintLBW(); } } } return(lbGroupLocationItem); }