Beispiel #1
0
    public void StartBuilding()
    {
        isBuilding = true;
        if (buildingProgressInterface)
        {
            buildingProgressInterface.SetActive(true);
        }
        initialBuild.SetActive(true);
        placementProjection.SetActive(false);
        IBuildBehaviour bb = initialBuild.GetComponent <IBuildBehaviour>();

        if (bb != null)
        {
            bb.StartBuilding();
        }
        progress = 0;
        threats  = 0;
        if (buildingProgressInterface)
        {
            buildingProgressInterface.SetActive(true);
        }
        if (buildingLifeInterface)
        {
            buildingLifeInterface.SetActive(false);
        }
    }
Beispiel #2
0
 private void ProgressInitialBuild()
 {
     progress   += multiplierTimer > 0 ? Time.deltaTime * multiplierDuration : Time.deltaTime * 1;
     currentLife = (int)(progress / timeToBuild * totalLife);
     if (buildingProgressBar)
     {
         buildingProgressBar.fillAmount = progress / timeToBuild;
     }
     if (progress >= timeToBuild)
     {
         IBuildBehaviour bb = initialBuild.GetComponent <IBuildBehaviour>();
         if (bb != null)
         {
             bb.FinishedBuilding();
         }
         if (buildingProgressInterface)
         {
             buildingProgressInterface.SetActive(false);
         }
         if (buildingLifeInterface)
         {
             buildingLifeInterface.SetActive(true);
         }
         if (buildingLifeBar)
         {
             buildingLifeBar.fillAmount = (float)currentLife / (float)totalLife;
         }
         isBuilding = false;
     }
 }