/// <summary> /// Creates a new BaseBuilding at the specified location and /// add that fromBuilding to a new Graph and then add that graph /// to the player. /// </summary> /// <param name="xCoord">The x-coordinate to spawn the BaseBuilding on /// </param> /// <param name="yCoord">The Y-coordinate to spawn the BaseBuilding on /// </param> /// <param name="owner">The player which this method will create a new /// graph.</param> private void SpawnGraph(int xCoord, int yCoord, Player owner) { /*BaseBuilding baseBuilding = new BaseBuilding("base", xCoord, yCoord, owner); * * theWorld.map.GetTile(xCoord, yCoord).SetBuilding(baseBuilding);*/ myLogger.Info("Creating graph for player: " + owner + " at: " + xCoord + "," + yCoord); //owner.AddGraph(new Graph(baseBuilding)); BuildingController.AddBuilding(Globals.BuildingTypes.Base, null, new Vector2(xCoord, yCoord), theWorld, owner); }
public GameObject SpawnSelectedBuilding(int selectedBuildingId) { GameObject building = Instantiate <GameObject>(buildings[selectedBuildingId], Camera.main.ScreenToWorldPoint(Input.mousePosition), Quaternion.identity); buildingController.AddBuilding(building, buildingTypes[selectedBuildingId]); building.transform.Translate(0, 0, 10); building.transform.GetChild(0).GetComponent <SpriteRenderer>().sortingOrder = 10; return(building); }