Example #1
0
    public void ChangeHouse(string s)
    {
        //if s is null, don't make the new house
        if (string.IsNullOrEmpty(s))
        {
            return;
        }

        //demolish this and build new house
        world.Demolish(X, Y);
        world.SpawnStructure(s, X, Y, transform.position.y);

        //set vars of new house to the ones from this one
        House newHouse = world.Map.GetBuildingAt(X, Y).GetComponent <House>();

        newHouse.Residents   = Residents;
        newHouse.Health      = Health;
        newHouse.Water       = Water;
        newHouse.WaterQual   = WaterQual;
        newHouse.Food        = Food;
        newHouse.Goods       = Goods;
        newHouse.Faith       = Faith;
        newHouse.Culture     = Culture;
        newHouse.VenueAccess = VenueAccess;

        //activate new house
        newHouse.Activate();
    }
Example #2
0
    public void TurnIntoHouse()
    {
        //demolish this and build new house
        world.Demolish(X, Y);
        world.SpawnStructure(house, X, Y, transform.position.y);

        House newHouse = world.Map.GetBuildingAt(X, Y).GetComponent <House>();

        newHouse.FreshHouse();
        newHouse.Activate();
    }
Example #3
0
    public void ActivateStructure()
    {
        currentModelSection = 0;        // reset the model section
        underConstruction   = false;

        if (completedModel != null)
        {
            completedModel.SetActive(true);
        }
        else
        {
            models [models.Length - 1].SetActive(true);
        }

        // Position all pieces of structure which haven't been placed yet
        for (int i = 0; i < models.Length; i++)
        {
            models [i].transform.localPosition = Vector3.zero;
            models [i].transform.localRotation = Quaternion.Euler(-180, 0, 0);
        }

        // NPCs upgrade when structure is repaired fully (opposite to the DamageStructure method)
        for (int i = 0; i < residentNPCs.Count; i++)
        {
            residentNPCs[i].UpgradeStats();
        }

//		for (int i = 0; i < models.Length; i++) {
//			if (i == level) {
//				models [i].SetActive (true);
//			} else {
//				models [i].SetActive (false);
//			}
//		}

        // completed builds on platforms
        if (housing)
        {
            House houseScript = GetComponent <House>();
            houseScript.Activate();
            kingScript.housingPlatformsUnderConstruction.Remove(this);
            kingScript.builtHousingPlatforms.Add(this);
        }
        else if (farming)
        {
            Farm farmScript = GetComponent <Farm>();
            farmScript.Activate();
            kingScript.farmingPlatformsUnderConstruction.Remove(this);
            kingScript.builtFarmingPlatforms.Add(this);
        }
        else if (workshop)
        {
            Workshop workshopScript = GetComponent <Workshop>();
            workshopScript.Activate();
            kingScript.workshopPlatformsUnderConstruction.Remove(this);
            kingScript.builtWorkshopPlatforms.Add(this);
        }
        else if (mine)
        {
            kingScript.miningPlatformsUnderConstruction.Remove(this);
            kingScript.builtMiningPlatforms.Add(this);
        }
        else if (archery)
        {
            Archery archeryScript = GetComponent <Archery>();
            archeryScript.Activate();
            kingScript.archeryPlatformsUnderConstruction.Remove(this);
            kingScript.builtArcheryPlatforms.Add(this);
        }
    }