コード例 #1
0
    IEnumerator CollectCoinsRoutine(CollectableCoin[] coins)
    {
        for (int i = 0; i < coins.Length; i++)
        {
            CollectCoin(coins[i]);

            yield return new WaitForSeconds(0.05f);
        }
    }
コード例 #2
0
    private void CollectCoin(CollectableCoin coin)
    {
        if (coin.gameObject.activeSelf)
        {
            playInfo.coins += coin.coinValue;

            GameObject collectEffect = ObjectPoolManager.Spawn(coinCollectEffect);
            //Instantiate(coinCollectEffect) as GameObject;
            collectEffect.GetComponent<CoinCollectEffect>().Setup(coin.transform.position, coinCollectTarget.transform.position);
            collectEffect.SetActive(true);

            ObjectPoolManager.Unspawn(coin.gameObject);
            gameUI.UpdateScreen();
        }
        else
        {
            Debug.Log("VIRHE VALTETTY!");
        }
    }