void OnEnable() { if (!cam) { cam = GameObject.FindWithTag("MainCamera").GetComponent <CamMoving>(); game = GameObject.FindWithTag("Player").GetComponent <Game>(); } else { if (section != cam.currentSection && cam.currentSection != game.GetMaxFloor() * 3) { section = cam.currentSection; } SetTower(); } }
void Start() { gameObject.transform.position = new Vector3(0, FLOOR_SIZE, 0); cam = GameObject.FindWithTag("MainCamera").GetComponent <CamMoving>(); maxFloorText = GameObject.FindWithTag("MaxFloor").GetComponent <Text>(); scroller = GameObject.FindWithTag("Scroller"); enemyHeight = GameObject.FindWithTag("EnemyHeight").GetComponent <RectTransform>(); SetEnemySection(enemySection); scoreText = GameObject.FindWithTag("Score").GetComponent <Text>(); goldField = GameObject.FindWithTag("GoldField"); goldText = GameObject.FindWithTag("Gold"); spawner = GameObject.FindWithTag("Spawner").GetComponent <Spawner>(); TopList = new List <GameObject>(); gold = startGold; ChangeGold(0); ChangeScore(0); }
void Start() { game = GameObject.FindWithTag("Player").GetComponent <Game>(); cam = GameObject.FindWithTag("MainCamera").GetComponent <CamMoving>(); goldText.text = gold.ToString(); }