Ejemplo n.º 1
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);
        }
    }