public void UpdateUI() { foreach (GameObject go in myToggles) { Destroy(go); } myToggles.Clear(); for (int i = 0; i < inventoryOfAbilities.myAbilities.Count; i++) { GameObject go = Instantiate(togglePrefab); go.transform.SetParent(content.transform); go.GetComponent <RectTransform>().anchoredPosition = new Vector3(0, -50 * i - 25); TowerSelector ts = go.GetComponent <TowerSelector>(); ts.SetImage(inventoryOfAbilities.myAbilities[i].GetIcon()); ts.abilitiesToAdd.Add(inventoryOfAbilities.myAbilities[i]); myToggles.Add(go); } }
void OnMouseUp() { towerSelector = GameObject.FindObjectOfType <TowerSelector> (); scoreManager = GameObject.FindObjectOfType <ScoreManager> (); selectedTower = towerSelector.tower; if (selectedTower == null) { return; } if (scoreManager.activeWave > 0 && scoreManager.money >= selectedTower.GetComponent <TowerStats> ().price) { transform.eulerAngles = new Vector3(0, 90, 0); tower = (GameObject)Instantiate(selectedTower, transform.position, transform.rotation); towerStats = tower.GetComponent <TowerStats> (); scoreManager.money -= towerStats.price; Destroy(gameObject); } }
void Start() { gameStatus = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameStatus>(); towerSelector = gameObject.GetComponent <TowerSelector>(); SpriteRenderer[] spriteRenderers = gameObject.GetComponentsInChildren <SpriteRenderer>(); foreach (SpriteRenderer spriteRenderer in spriteRenderers) { if (spriteRenderer.gameObject == gameObject) { cursorSprite = spriteRenderer; continue; } if (spriteRenderer.gameObject.name == "Tower Ghost") { towerGhost = spriteRenderer; } if (spriteRenderer.gameObject.name == "Cost Counter") { costCounter = spriteRenderer; } } }
void Start() { towerSelector = GetComponentInParent <TowerSelector>(); }
private void Awake() { Instance = this; }
// Start is called before the first frame update void Start() { Instance = this; BuyList = new List <BuyTowerBTN>(); }
void Start() { InitializeNetwork(); resourcesManager = GetComponent<ResourcesManager>(); resourcesPrices = GetComponent<ResourcesPrices>(); towerSelector = GetComponent<TowerSelector>(); }
private void Start() { towerSelector = FindObjectOfType <TowerSelector>(); gameManager = FindObjectOfType <GameManager>(); }
public void Init(int newID, TowerSelector selector) { MyTowerID = newID; TS = selector; }
// Use this for initialization void Start() { towerSelector = GetComponentInParent <TowerSelector>(); text = GetComponent <Text>(); gameStatus = GetComponentInParent <GameStatus>(); }