Exemplo n.º 1
0
        //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");
        }
Exemplo n.º 2
0
        public IEnumerator DestroyTower(BuildTeam team)
        {
            if (team != null)
            {
                team.busy = true;
            }
            //disable targeting
            GetComponent <TargetAcquisition>().enabled = false;
            //run animation
            yield return(new WaitForSeconds(destroyTime));

            //clear this buildSite
            myTile.RemoveTower();
            //destroy model
            if (team != null)
            {
                team.EndJob();
            }
            Debug.Log("Tower Destroyed");
            Destroy(this.gameObject);
        }