/// <summary> /// Called from Update if createSoilNow = true /// Creates all the planes for the farm. Based on initial position and scale /// </summary> /// <param name="pos">The list of initial positions for each tile</param> /// <param name="containerP">The container will hold all tiles. Usually is this.transform</param> void CreatePlanesRoutine(List <Vector3> pos, Transform containerP) { if (loopCounter < pos.Count) { CreatePlane temp = null; if (HType == H.Road) { temp = CreatePlane.CreatePlanSmartTile(this, Root.createPlane, Root.RetMaterialRoot(MaterialKey), pos[loopCounter], scale: Program.gameScene.ScaleSmallRoadUnitFarm, container: containerP); } else { temp = CreatePlane.CreatePlan(Root.createPlane, Root.RetMaterialRoot(MaterialKey), pos[loopCounter], scale: Program.gameScene.ScaleSmallRoadUnitFarm, container: containerP, hType: HType); } _planesSoil.Add(temp); loopCounter++; } else { createSoilNow = false; AfterLoopRoutine(); } }
/// <summary> /// Creates the plane of pos lineanly /// </summary> List <CreatePlane> CreatePlanes(List <Vector3> pos, Transform containerP, Vector3 scaleP, string materialKey, Building spawner) { List <CreatePlane> res = new List <CreatePlane>(); for (int i = 0; i < pos.Count; i++) { if (spawner.HType == H.Road) { res.Add(CreatePlane.CreatePlanSmartTile(spawner, Root.createPlane, Root.RetMaterialRoot(materialKey), pos[i], scale: scaleP, container: containerP, isLoadingFromFile: true)); } else { res.Add(CreatePlane.CreatePlan(Root.createPlane, Root.RetMaterialRoot(materialKey), pos[i], scale: scaleP, container: containerP)); } } return(res); }