コード例 #1
0
ファイル: UIManager.cs プロジェクト: spawncamper/lmgj
    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();
    }
コード例 #2
0
ファイル: CoinSpawner.cs プロジェクト: spawncamper/lmgj
    // 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");
            }
        }
    }