void UpdateScore() { if (coinController == null) { Debug.LogError("[UIManager] coinController is null"); } currentCoins = coinController.ReturnCurrentCoins(); if (scoreText == null) { Debug.LogError("[UIManager] scoreText is null"); } scoreText.text = currentCoins.ToString(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown("space")) { if (coinController.ReturnCurrentCoins() >= 1) { if (CoinSpawnedEvent != null) { CoinSpawnedEvent(); } Vector3 CoinPosition = new Vector3(transform.position.x, 0.65f, transform.position.z); GameObject cointInstance = Instantiate(coinPrefab, CoinPosition, Quaternion.identity) as GameObject; cointInstance.transform.parent = coinController.transform; } else { Debug.LogWarning("[CoinController] currentCoins = 0"); } } }