Beispiel #1
0
 public void StartBuildMode()
 {
     if (mode != Mode.NONE || busy)
     {
         return;
     }
     TowerBuildSite.StartBuildMode(this);
     this.mode = Mode.BUILD;
 }
        //TODO: Fix the thing where towers have to be destroied after the new ne is active.
        public IEnumerator MoveTower(BuildTeam team, TowerBuildSite newSite)
        {
            team.busy = true;
            //save refrence to tower
            //destroy tower
            StartCoroutine(DestroyTower(null));

            //call construction on new site
            TowerConstructionHandler newTower = Instantiate(thisTowerPrefab, newSite.gameObject.transform).GetComponent <TowerConstructionHandler>();

            team.BeginConstruction(newTower);
            StartCoroutine(newTower.ConstructTower(team, newSite));
            yield return(new WaitForSeconds(0));

            Debug.Log("Tower Move in progress.");
        }
        //Building Script
        public IEnumerator ConstructTower(BuildTeam team, TowerBuildSite location)
        {
            Debug.Log("Tower Construction in Progress...");
            team.busy = true;
            myTile    = location; //for use with deconstruction
            location.BuildTower();

            //disable targeting
            //TODO: run construction animation
            GetComponent <TargetAcquisition>().enabled = false;

            //Wait for it to end
            yield return(new WaitForSeconds(activationTime));

            //Reenable the build team and activate targeting.
            team.EndJob();
            GetComponent <TargetAcquisition>().enabled = true;
            Debug.Log("Tower built... Targeting active");
        }
Beispiel #4
0
 public void StartMoveMode()
 {
     this.mode = Mode.MOVE;
     TowerConstructionHandler.MoveMode(this);
     TowerBuildSite.StartMoveMode(this);
 }