コード例 #1
0
ファイル: TowerBuildSite.cs プロジェクト: csugda/Altair
        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();
 }