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)); }
public void OnMouseUp() { switch (mode) { case Mode.NONE: break; case Mode.MOVE: selectedMoveTower = this; break; case Mode.DESTROY: StartCoroutine(DestroyTower(activeTeam)); break; } }
//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."); }
public static void cancelMove() { selectedMoveTower = null; }
public void BeginConstruction(TowerConstructionHandler construction) { busy = true; EndJob(); }
public void StartDestroyMode() { this.mode = Mode.DESTROY; TowerConstructionHandler.DestructionMode(this); }
public void StartMoveMode() { this.mode = Mode.MOVE; TowerConstructionHandler.MoveMode(this); TowerBuildSite.StartMoveMode(this); }
public void CancelJob() { this.mode = Mode.NONE; TowerConstructionHandler.cancelMove(); }