public static List <DetectedBuilding> DetectBuildings(Space space, BlueprintLibrary library) { List <BaseBlueprint> bPrints = library.GetAllBlueprints(); bPrints = FindPossibleBlueprints(bPrints, space.GetAvaiableMaterial()); Tile[,] Map = space.Map; List <DetectedBuilding> possibleBuildings = new List <DetectedBuilding>(); for (int x = 0; x < Map.GetLength(0); x++) { for (int z = 0; z < Map.GetLength(1); z++) { foreach (var item in bPrints) { SimpleCords cord = new SimpleCords(x, z); // rotate for (int i = 0; i < 4; i++) { if (CheckBlueprint(Map, item, cord, i)) { possibleBuildings.Add(new DetectedBuilding(item.Name, cord, i)); } } } } } return(possibleBuildings); }
// Use this for initialization void Start() { btn1.onClick.AddListener(() => { activeTool = Tool.Shovel; txt.text = "Shovel"; }); btn2.onClick.AddListener(() => { activeTool = Tool.Move; txt.text = "Move"; }); btn3.onClick.AddListener(() => { activeTool = Tool.Delete; txt.text = "Destroy"; }); space = new Space(6, 6); blueprints = new BlueprintLibrary(); buildings = new BuildingLibrary(); materials = new MaterialLibrary(); toolTip = GameObject.FindGameObjectWithTag("ToolTip").GetComponent <TooltipScript>(); }