예제 #1
0
        public void OnMouseUp()
        {
            if (moveMode && TowerConstructionHandler.selectedMoveTower != null)
            {
                StartCoroutine(TowerConstructionHandler.selectedMoveTower.MoveTower(activeTeam, this));
                return;
            }
            if (!buildMode)
            {
                return;
            }
            if (towerExists || !this.buildable || EventSystem.current.IsPointerOverGameObject())
            {
                return;
            }
            BuildTeam team = activeTeam;
            //maybe not pass this, but pass the construction site. that really makes more sense.

            //TODO this should do something else to handle the construction site.
            TowerConstructionHandler tower = Instantiate(towers.RandomPrefab(), this.gameObject.transform.parent).GetComponent <TowerConstructionHandler>();

            team.BeginConstruction(tower);

            StartCoroutine(tower.ConstructTower(team, this));
        }
예제 #2
0
        public void OnMouseUp()
        {
            switch (mode)
            {
            case Mode.NONE:
                break;

            case Mode.MOVE:
                selectedMoveTower = this;
                break;

            case Mode.DESTROY:
                StartCoroutine(DestroyTower(activeTeam));
                break;
            }
        }
예제 #3
0
        //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.");
        }
예제 #4
0
 public static void cancelMove()
 {
     selectedMoveTower = null;
 }
예제 #5
0
파일: BuildTeam.cs 프로젝트: csugda/Altair
 public void BeginConstruction(TowerConstructionHandler construction)
 {
     busy = true;
     EndJob();
 }
예제 #6
0
파일: BuildTeam.cs 프로젝트: csugda/Altair
 public void StartDestroyMode()
 {
     this.mode = Mode.DESTROY;
     TowerConstructionHandler.DestructionMode(this);
 }
예제 #7
0
파일: BuildTeam.cs 프로젝트: csugda/Altair
 public void StartMoveMode()
 {
     this.mode = Mode.MOVE;
     TowerConstructionHandler.MoveMode(this);
     TowerBuildSite.StartMoveMode(this);
 }
예제 #8
0
파일: BuildTeam.cs 프로젝트: csugda/Altair
 public void CancelJob()
 {
     this.mode = Mode.NONE;
     TowerConstructionHandler.cancelMove();
 }