void Awake() { path = new List <BuildTile>(); grid = new BuildTile[numRows, numCols]; float topEdge = (float)(spacing * (numRows / 2.0 - 0.5)); float leftEdge = (float)-(spacing * (numCols / 2.0 - 0.5)); for (int i = 0; i < numRows; ++i) { GameObject row = new GameObject("row"); row.transform.parent = gameObject.transform; row.transform.localPosition = new Vector3(0, topEdge - (spacing * i), 0); for (int j = 0; j < numCols; ++j) { BuildTile tile = Instantiate(tileScript); tile.transform.parent = row.transform; tile.transform.localPosition = new Vector3(leftEdge + (spacing * j), 0, 0); tile.transform.localScale = new Vector3(scaling, scaling, 0); tile.tileData.coord = new Coord(i, j); tile.mapScript = this; grid[i, j] = tile; } } }
public bool CheckBuildEligible(Vector3Int tileLocation, BuildTile tile) { if (!CheckWithinBounds(tileLocation)) { return(false); } return((tile.tileType == BuildTile.TileTypes.NONE) || !CheckOccupied(tileLocation)); }
// Adds a new BuildTile to the build menu + performs layout public void AddBuildTile(BuildTile newTile) { if (_buildCandidates.Contains(newTile)) { return; } _buildCandidates.Add(newTile); LayoutBuildTile(newTile, _buildCandidates.Count); }
// Update is called once per frame void Update() { switch (GameManager.Instance.CurrentState) { case GameState.Game: if (Input.GetMouseButtonDown(0)) { if (buildPanelshown) { //ignore clicking inside the build panel if (RectTransformUtility.RectangleContainsScreenPoint(buildPanel.GetComponent <RectTransform>(), Input.mousePosition)) { return; } hideBuildPanel(); } // get the object beneath the cursor RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero); if (hit.collider == null) { return; } GameObject rayObstacle = hit.collider.gameObject; if (rayObstacle.tag == "buildTile" && !rayObstacle.GetComponent <BuildTile>().Occupied) { //save selectedBuildPanel selectedBuildTile = rayObstacle.GetComponent <BuildTile>(); //show build panel buildPanel.SetActive(true); Vector2 buildPanelPosition = Input.mousePosition; buildPanelPosition.x -= (buildPanel.GetComponent <RectTransform>().rect.width *canvas.scaleFactor) / 2; buildPanelPosition.y -= (buildPanel.GetComponent <RectTransform>().rect.height *canvas.scaleFactor) / 2; buildPanel.transform.position = buildPanelPosition; buildPanel.transform.Find("SiegeTowerAvatar").gameObject.SetActive(selectedBuildTile.IsSiegeCompatible); buildPanelshown = true; } else if (rayObstacle.tag == "tower") { } } break; } }
public override void OnInspectorGUI() { EditorGUILayout.HelpBox("This script will instantiate tiles", MessageType.Info); base.OnInspectorGUI(); BuildTile script = (BuildTile)target; if (script != null) { if (GUILayout.Button("Build Tile")) { script.InstantiateTile(); } } }
public void CreateTile(int x, int y, TileTypes tt, bool blown) { if (m_tiles[x, y] == null) { m_tiles[x, y] = new BuildTile(); } if (m_prefabs.ContainsKey(tt) == false) { Debug.LogError("Cannot Find Prefab for " + tt); return; } m_tiles[x, y].m_type = tt; m_tiles[x, y].m_isBurning = false; if (m_prefabs[tt].m_blownTile) { m_tiles[x, y].m_isBlown = blown; m_tiles[x, y].m_blownTile = Instantiate(m_prefabs[tt].m_blownTile) as GameObject; m_tiles[x, y].m_blownTile.name = "Tile Row" + y + " Col" + x + " " + tt + " X"; m_tiles[x, y].m_blownTile.transform.parent = transform; m_tiles[x, y].m_blownTile.transform.localPosition = new Vector3(4.0f * (x - m_rowWidth * 0.5f), 4.0f * y, 0.0f); AddTileRef(m_tiles[x, y].m_blownTile, x, y); m_tiles[x, y].m_blownTile.SetActive(blown); BurnContain[] bcList = m_tiles[x, y].m_blownTile.GetComponentsInChildren <BurnContain>(true); foreach (BurnContain bc in bcList) { AddTileRef(bc.gameObject, x, y); bc.gameObject.SetActive(false); } } else { blown = false; } m_tiles[x, y].m_tile = Instantiate(m_prefabs[tt].m_tile) as GameObject; m_tiles[x, y].m_tile.name = "Tile Row" + y + " Col" + x + " " + tt; m_tiles[x, y].m_tile.transform.parent = transform; m_tiles[x, y].m_tile.transform.localPosition = new Vector3(4.0f * (x - m_rowWidth * 0.5f), 4.0f * y, 0.0f); AddTileRef(m_tiles[x, y].m_tile, x, y); m_tiles[x, y].m_tile.SetActive(!blown); }
// Creates a button and performs layout for a build tile private void LayoutBuildTile(BuildTile tile, int tileNumber) { var candidate = tile; var baby = Instantiate <GameObject>(buildCandidateButton, Vector3.zero, Quaternion.identity, scrollableItemsContent); var switcher = baby.GetComponent <BuildTileSwitcher>(); switcher.assignedTile = candidate; switcher.GetComponentInChildren <UnityEngine.UI.Text>().text = candidate.myName; switcher.designController = this; buttons[tile] = switcher; buttonsByName[tile.myName] = switcher; var switcherRect = switcher.GetComponent <RectTransform>(); switcherRect.offsetMin = new Vector2(tileNumber * 150, -100); switcherRect.offsetMax = new Vector2((++tileNumber) * 150, 0); scrollableItemsContent.offsetMax = new Vector2((_buildCandidates.Count + 00) * 175, scrollableItemsContent.offsetMax.y); }
public void reset() { path.Clear(); for (int i = 0; i < validTiles.Length; ++i) { validTiles[i] = null; } for (int i = 0; i < numRows; i++) { for (int j = 0; j < numCols; j++) { BuildTile tile = grid[i, j]; tile.setSprite(TSprites.emptyTile); tile.state = TileData.State.EMPTY; tile.startDirection = TileData.Direction.UNSET; tile.endDirection = TileData.Direction.UNSET; tile.unhighlight(); } } readyButton.interactable = false; instructions.text = "Pick your starting point"; }
private static string CreateAvatarUrl(BuildTile build) { return($"avatar/{build.UserEmail}"); }
public void WriteGridCell(Vector3Int tileLocation, int rotations, GameObject obj, BuildTile tileObj) { // TODO: magic only FOUR orientations!!! Debug.Assert(rotations >= 0 && rotations <= 4); var cellData = gridCells[GetCellIndexFromTileLocation(tileLocation)]; cellData.tileType = tileObj; cellData.cellObject = obj; cellData.rotations = rotations; gridCells[GetCellIndexFromTileLocation(tileLocation)] = cellData; }
/// <summary> /// Returns true if the given unit type can be built at the given build tile position. /// If builder is not null, the unit will be discarded when determining whether or not any ground units are blocking the build location. /// </summary> /// <param name="builder">Builder worker.</param> /// <param name="buildTile">Top left tile of the building.</param> /// <param name="building">Type of a building unit to build.</param> /// <returns></returns> public static bool CanBuildHere(Unit builder, BuildTile buildTile, UnitTypes building) { return SWIG.BWAPI.bwapi.Broodwar.canBuildHere(builder.BwapiObject, buildTile.BwapiObject, new SWIG.BWAPI.UnitType((int)building)); }
/// <summary> /// Returns true if the given build location is powered by a nearby friendly pylon. /// </summary> /// <param name="buildTile"></param> /// <param name="tileWidth"></param> /// <param name="tileHeight"></param> /// <returns></returns> public static bool TileHasPower(BuildTile buildTile, int tileWidth, int tileHeight) { return SWIG.BWAPI.bwapi.Broodwar.hasPower(buildTile.BwapiObject, tileWidth, tileHeight); }
/// <summary> /// Returns true if the specified build tile has zerg creep on it. /// If the tile is concealed by fog of war, the function will return false. /// </summary> /// <param name="buildTile"></param> /// <returns></returns> public static bool TileHasCreep(BuildTile buildTile) { return SWIG.BWAPI.bwapi.Broodwar.hasCreep(buildTile.BwapiObject); }
/// <summary> /// Orders the unit to build the given unit type at the given position. /// Note that if the player does not have enough resources when the unit attempts /// to place the building down, the order will fail. /// </summary> /// <param name="tilePosition">Top left corner of the building</param> /// <param name="unitType"></param> /// <returns></returns> public bool DoBuild(BuildTile tilePosition, UnitTypes unitType) { return this.BwapiObject.build(tilePosition.BwapiObject, new SWIG.BWAPI.UnitType((int)unitType)); }
public int CheckInventory(BuildTile _item) { return(GamePlay.inventory[_item.name].qtyInStock); }
/// <summary> /// Returns the set of units that are on the given build tile. /// Only returns accessible units on accessible tiles. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public static List<Unit> GetUnitsOnBuildTile(BuildTile buildTile) { return Unit.GetListOfUnits(SWIG.BWAPI.bwapi.Broodwar.unitsOnTile(buildTile.X, buildTile.Y)); }
public void OnGUI() { #region UIRendering //load the gui skin GUI.skin = skin; int ResolutionWidth = Screen.width; int ResolutionHeight = Screen.height; PathStart WaveManager = GameObject.Find("PathPoint (0)").GetComponent <PathStart>(); //draw the tower selection grid int boxNumber = ((Screen.height - 315) / 100) * 2; List <GUIContent> TowerSelectionGrid = new List <GUIContent>(); for (int i = towerPage * boxNumber; i < Towers.Count && i < boxNumber + towerPage * boxNumber; i++) { TowerSelectionGrid.Add(new GUIContent(Towers[i].Name + "\n<size=16>cost:" + Towers[i].TowerObject.GetComponent <Tower>().getCost() + "</size>", Towers[i].GuiTexture == null ? NoTowerImage : Towers[i].GuiTexture)); } for (int i = TowerSelectionGrid.Count; i < boxNumber; i++) { TowerSelectionGrid.Add(new GUIContent("")); } //draw the box for money and health; GUI.Box(new Rect(ResolutionWidth - 200, 0, 200, 100), new GUIContent("Health:" + GameObject.FindGameObjectWithTag("ProtectedObject").GetComponent <ProtectedObject>().health + "\n Money:" + money + "\n Score:" + PathManager.Score)); selectorGrid = GUI.SelectionGrid(new Rect(ResolutionWidth - 200, 105, 200, ResolutionHeight - 315), selectorGrid, TowerSelectionGrid.ToArray(), 2); //draw the next button for tower page if (towerPage == TowerPageMax) { GUI.Box(new Rect(ResolutionWidth - 98, ResolutionHeight - 205, 98, 100), new GUIContent("<color=#808080ff>next</color>")); } else if (GUI.Button(new Rect(ResolutionWidth - 98, ResolutionHeight - 205, 98, 100), new GUIContent("next"))) { towerPage += 1; } //draw the previous button for tower page if (towerPage == 0) { GUI.Box(new Rect(ResolutionWidth - 200, ResolutionHeight - 205, 98, 100), new GUIContent("<color=#808080ff>Previous</color>")); } else if (GUI.Button(new Rect(ResolutionWidth - 200, ResolutionHeight - 205, 98, 100), new GUIContent("Previous"))) { towerPage -= 1; } //check if the player can go to the next wave if (WaveManager.CanNextWave) { //check if the level is finished if (WaveManager.isFinalWave) { // create finished texture GUIStyle OuterBox = new GUIStyle(GUI.skin.box); Texture2D texture = new Texture2D(1, 1); texture.SetPixel(0, 0, Color.white); texture.Apply(); OuterBox.normal.background = texture; //display finished message and the button to end the game GUI.Label(new Rect(ResolutionWidth / 2 - 500, ResolutionHeight / 2 - 100, 500, 150), "", OuterBox); GUI.Label(new Rect(ResolutionWidth / 2 - 500, ResolutionHeight / 2 - 100, 500, 150), new GUIContent("<size=128><color=Black>Great Job</color></size>")); if (GUI.Button(new Rect(ResolutionWidth - 200, ResolutionHeight - 100, 200, 100), new GUIContent("Exit to Main Menu"))) { PlayerPrefs.SetInt("level:" + UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex, (int)PathManager.Score); UnityEngine.SceneManagement.SceneManager.LoadScene(0); } } //otherwise show a button to go to next level else if (GUI.Button(new Rect(ResolutionWidth - 200, ResolutionHeight - 100, 200, 100), new GUIContent("Next Wave" + WaveManager.TimeToNextWave))) { WaveManager.nextWave(); } } else { GUI.Box(new Rect(ResolutionWidth - 200, ResolutionHeight - 100, 200, 100), new GUIContent("Wave In Progress")); } //show options button if (GUI.Button(new Rect(8, ResolutionHeight - 40, 32, 32), GearSymbol)) { Options = !Options; } //show music button if (GUI.Button(new Rect(48, ResolutionHeight - 40, 32, 32), music ? MusicSymbol : NoMusicSymbol)) { music = !music; PlayerPrefs.SetInt("music", music ? 1 : 0); AudioListener.volume = music ? 1 : 0; } #endregion #region UIControls //move camera around if (Input.GetAxis("Mouse ScrollWheel") < 0 || Input.GetAxis("Mouse ScrollWheel") > 0 && Camera.main != null) { Camera.main.orthographicSize = Mathf.Max(Mathf.Min(-8 * scrollSpeed * Input.GetAxis("Mouse ScrollWheel") + Camera.main.orthographicSize, 50), 5); } //if user presses e open the options menu if (Input.GetKeyDown(KeyCode.Escape) & Time.unscaledTime - buttonTime > .5f) { Options = !Options; buttonTime = Time.unscaledTime; } //show options menu if (Options) { //draw options box Rect OptionsBox = new Rect((ResolutionWidth - 200) / 2, (ResolutionHeight - 132) / 2, 200, 152); GUI.Box(OptionsBox, ""); //draw the quit buttons if (GUI.Button(new Rect(OptionsBox.xMin + (OptionsBox.width - 150) / 2, OptionsBox.yMin + 16, 150, 50), "Quit To Windows")) { Application.Quit(); } if (GUI.Button(new Rect(OptionsBox.xMin + (OptionsBox.width - 150) / 2, OptionsBox.yMin + 66, 150, 50), "Quit To Main Menu")) { UnityEngine.SceneManagement.SceneManager.LoadScene(0); } hardness = !GUI.Toggle(new Rect(OptionsBox.xMin + (OptionsBox.width - 150) / 2, OptionsBox.yMin + 116, 150, 50), hardness, "Hard Mode"); PlayerPrefs.SetInt("Hardness", hardness?1:0); } //show the diologue for selling towers else if (ThingToSell != null) { //convert 3d point to 2d screen position Vector3 screenPosition = Camera.main.WorldToScreenPoint(ThingToSell.transform.position + Vector3.up); // gets screen position.\ screenPosition.y = Screen.height - (screenPosition.y + 1); // inverts y Rect rect = new Rect(screenPosition.x - 50, screenPosition.y - 12, 100, 60); // makes a rect centered at the player ( 100x24 ) GUI.Box(rect, "", GUI.skin.box); //shjow sell button if (GUI.Button(new Rect(rect.xMin + 4, rect.yMin + 4, 92, 24), "Sell", GUI.skin.button)) { money += hardness? ThingToSell.getCost() / 2:0; Destroy(ThingToSell.gameObject); } //show cancel button else if (GUI.Button(new Rect(rect.xMin + 4, rect.yMin + 28, 92, 24), "Cancel", GUI.skin.button)) { ThingToSell = null; } } //check for user mouse click else if (Input.GetMouseButtonDown(0)) { if (justclicked == false) { //check iuf the user clicked on a tile RaycastHit hit; Ray clicked3D = Camera.main.ScreenPointToRay(Input.mousePosition); Physics.Raycast(clicked3D, out hit, 100000f); if (hit.transform != null && hit.transform.gameObject.tag == "BuildTile") { //if clicked on a tile create tower BuildTile Tile = hit.transform.gameObject.GetComponent <BuildTile>(); if (Tile.Tower == null) { if (money >= Towers[selectorGrid + towerPage * boxNumber].TowerObject.GetComponent <Tower>().getCost()) { money -= Towers[selectorGrid + towerPage * boxNumber].TowerObject.GetComponent <Tower>().getCost(); Tile.Tower = (Instantiate(Towers[selectorGrid + towerPage * boxNumber].TowerObject, hit.transform.position + new Vector3(0, .75f, 0), new Quaternion()) as GameObject); } } } //if user clicked on tower show sell diologue else if (hit.transform != null && hit.transform.gameObject.tag == "Tower") { ThingToSell = hit.transform.gameObject.GetComponent <Tower>(); } } justclicked = !justclicked; } //move camera based on arrow keys and wasd MousePositionMoving = new Vector3(0, 0, 0); if (Input.GetMouseButton(2) == true) { MousePositionMoving = new Vector3(MouseLastX - Input.mousePosition.x, MouseLastY - Input.mousePosition.y, 0) * (Camera.main.orthographicSize / 160); } MouseLastX = (int)Input.mousePosition.x; MouseLastY = (int)Input.mousePosition.y; Camera.main.transform.Translate(new Vector3(Input.GetAxis("Horizontal") * cameraMouseSpeed, Input.GetAxis("Vertical") * cameraMouseSpeed, 0) + MousePositionMoving); //if user presses e turn the camera if (Input.GetKey(KeyCode.E)) { //Find point from camera and angle to y = zero point float angle; Vector3 axis; this.transform.rotation.ToAngleAxis(out angle, out axis); Vector3 LookDir = this.transform.rotation * new Vector3(0, 0, 1); Vector2 RatioDir = new Vector2(LookDir.x, LookDir.z); RatioDir.Normalize(); //rotate around this point Vector3 endPoint = new Vector3(transform.position.x + RatioDir.x * transform.position.y, 0, transform.position.z + RatioDir.y * transform.position.y); this.transform.RotateAround(endPoint, Vector3.up, scrollSpeed / -3); } //if user presses e turn the camera if (Input.GetKey(KeyCode.Q)) { //Find point from camera and angle to y = zero point float angle; Vector3 axis; this.transform.rotation.ToAngleAxis(out angle, out axis); Vector3 LookDir = this.transform.rotation * new Vector3(0, 0, 1); Vector2 RatioDir = new Vector2(LookDir.x, LookDir.z); RatioDir.Normalize(); //rotate around this point Vector3 endPoint = new Vector3(transform.position.x + RatioDir.x * transform.position.y, 0, transform.position.z + RatioDir.y * transform.position.y); this.transform.RotateAround(endPoint, Vector3.up, scrollSpeed / 3); } #endregion }
/// <summary> /// Orders the unit to land. Unit must be a Terran building that is currently lifted. /// See also: DoLift(), IsLifted /// </summary> /// <param name="tilePositionTarget"></param> /// <returns></returns> public bool DoLand(BuildTile tilePositionTarget) { return this.BwapiObject.land(tilePositionTarget.BwapiObject); }
void OnBuildCandidateChangedInternal(BuildTile candidate) { previewMeshFilter.mesh = candidate.buildMesh; }
public void onTileClick(BuildTile tile) { if (disabled) { return; } // Check for start tile. if (path.Count == 0) { if (tile.coord.col == 0) { tile.setSprite(TSprites.startTile); tile.state = TileData.State.PATH; tile.startDirection = TileData.Direction.LEFT; tile.endDirection = TileData.Direction.RIGHT; path.Add(tile); validTiles[0] = null; validTiles[1] = getTile(tile.coord.row, tile.coord.col + 1); validTiles[2] = null; validTiles[1].highlight(); instructions.text = "Build path for monsters attacking you"; } return; } // Check for subsequent tiles BuildTile prev = path[path.Count - 1]; int valid = Array.IndexOf(validTiles, tile); if (valid < 0 && !tile.Equals(prev)) { return; } // Clear valid tiles. for (int i = 0; i < validTiles.Length; ++i) { if (validTiles[i] != null) { validTiles[i].unhighlight(); validTiles[i] = null; } } // check if is undo. if (tile.Equals(prev)) // Undo tile. { tile.startDirection = TileData.Direction.UNSET; tile.setSprite(TSprites.emptyTile); tile.state = TileData.State.EMPTY; path.RemoveAt(path.Count - 1); readyButton.interactable = false; if (path.Count == 0) { instructions.text = "Pick your starting point"; return; } tile = path[path.Count - 1]; if (path.Count == 1) { validTiles[0] = null; validTiles[1] = getTile(tile.coord.row, tile.coord.col + 1); validTiles[2] = null; validTiles[1].highlight(); instructions.text = "Build path for monsters attacking you"; return; } else { tile.endDirection = TileData.Direction.UNSET; } } else // Adding tile. // Set directions. { switch (valid) { case 0: // Going up. prev.endDirection = TileData.Direction.UP; tile.startDirection = TileData.Direction.DOWN; break; case 1: // Going right. prev.endDirection = TileData.Direction.RIGHT; tile.startDirection = TileData.Direction.LEFT; break; case 2: // Going down. prev.endDirection = TileData.Direction.DOWN; tile.startDirection = TileData.Direction.UP; break; } // Set the prev tile sprite. (2nd tile ownwards) if (path.Count >= 2) { Sprite prev_s = TSprites.decideSprite(prev.startDirection, prev.endDirection); if (prev_s != null) { prev.setSprite(prev_s); } } tile.state = TileData.State.PATH; path.Add(tile); // Check if is last tile. if (tile.coord.col + 1 >= numCols) { tile.setSprite(TSprites.endTile); instructions.text = "Path is complete, are you ready?"; readyButton.interactable = true; return; } } // Set sprite Sprite s = TSprites.decideSprite(tile.startDirection, tile.endDirection); if (s != null) { tile.setSprite(s); } // Set valid tiles int cur_row = tile.coord.row; int cur_col = tile.coord.col; // Up BuildTile v_tile = getTile(cur_row - 1, cur_col); if (v_tile != null && !path.Contains(v_tile)) { v_tile.highlight(); validTiles[0] = v_tile; } // Right v_tile = getTile(cur_row, cur_col + 1); if (v_tile != null && !path.Contains(v_tile)) { v_tile.highlight(); validTiles[1] = v_tile; } // Down v_tile = getTile(cur_row + 1, cur_col); if (v_tile != null && !path.Contains(v_tile)) { v_tile.highlight(); validTiles[2] = v_tile; } }
/// <summary> /// Returns true if the specified build tile is visible. If the tile is concealed by fog of war, the function will return false. /// </summary> /// <param name="buildTile"></param> /// <returns></returns> public static bool TileIsVisible(BuildTile buildTile) { return SWIG.BWAPI.bwapi.Broodwar.isVisible(buildTile.BwapiObject); }
public void BuyItem(bool _cheatMode) { if (GamePlay.inventory == null) { GamePlay.inventory = new Dictionary <string, BaseItem>(); } if (_cheatMode || GamePlay.coin > CurrentItem.purchasecost) { if (!CanBuild(CurrentItem.itemname)) { BuildTile bt = new BuildTile(); bt.buildPrefab = Resources.Load(CurrentItem.prefab) as GameObject; bt.myName = CurrentItem.itemname; bt.tileType = CurrentItem.AssetType;// == AssetTypes.TRACK ? BuildTile.TileTypes.RAIL : BuildTile.TileTypes.SCENARY; CurrentItem.qtyInStock = 1; bt.dangerContribution = CurrentItem.dangerContribution > 5?CurrentItem.dangerContribution:5; if (bt.tileType == BuildTile.TileTypes.RAIL) { BuildTile.TileConnections[] baseConnections = new BuildTile.TileConnections[CurrentItem.connections.Length]; //Decode connections. int r = -1; string cons = CurrentItem.connections.ToUpper(); for (int i = 0; i < CurrentItem.connections.Length; i++) { switch (cons[i]) { case 'N': r = 0; break; case 'E': r = 1; break; case 'S': r = 2; break; case 'W': r = 3; break; default: break; } baseConnections[i] = (BuildTile.TileConnections)r; } bt.baseConnections = baseConnections; } bt.ForceValidate(); if (!GamePlay.inventory.ContainsKey(CurrentItem.itemname)) { GamePlay.inventory.Add(CurrentItem.itemname, CurrentItem); DesignController.instance.AddBuildTile(bt); DesignController.instance.buttonsByName[CurrentItem.itemname].SetButtonState(true); } } else { incInventory(CurrentItem.itemname); if (GamePlay.inventory[CurrentItem.itemname].qtyInStock > 0) { DesignController.instance.buttonsByName[CurrentItem.itemname].SetButtonState(true); } } GamePlay.coin -= !_cheatMode? CurrentItem.purchasecost:0; wallet.text = $"Currante Balance:{GamePlay.coin.ToString()}"; } else { //TODO do a different thing to say not enough cash.\ Sequence dialogBounceFade = DOTween.Sequence(); dialogBounceFade.Append(fadeDialog.DOFade(1, .3f)); dialogBounceFade.AppendInterval(1); dialogBounceFade.Append(fadeDialog.DOFade(0, .3f)); dialogBounceFade.PlayForward(); } }
/// <summary> /// Returns true if the specified build tile has been explored (was visible at some point in the match). /// </summary> /// <param name="buildTile"></param> /// <returns></returns> public static bool TileIsExplored(BuildTile buildTile) { return SWIG.BWAPI.bwapi.Broodwar.isExplored(buildTile.BwapiObject); }
public bool CanBuild(BuildTile _item) { return(GamePlay.inventory[_item.name].qtyInStock > 0); }
void Awake() { instance = this; }