Exemple #1
0
    // Save new House
    public void SaveHouse()
    {
        string address = FindObjectOfType <InputField>().text;

        if (address != "")
        {
            // Save the House to the model.
            House house = new House("shack", address, newBuilding);
            currentTown.AddHouse(house);
            // Navigate Back to the Menu
            ReturnToBuildScreenMenu();
            PopulateBuildingSelector();
            // Reload the world map
            Debug.Log("Save House " + address);
            Debug.Log("Cost: " + house.value + " - " + house.resources);
            currentView.BuildMap(currentTown);
            GameObject.Find("Town").GetComponent <SpriteRenderer>().sprite = Sprite.Create(currentView.mapTexture, new Rect(0, 0, currentView.mapTexture.width, currentView.mapTexture.height), new Vector2(0, 0));
        }
        else
        {
            Debug.Log("Must give an address!");
        }
    }