private void OnDestroy()
 {
     for (int i = 0; i < coinImageCount; i++)
     {
         CoinImage coinImage = m_coinImageInstances[i];
         if (!coinImage)
         {
             continue;
         }
         coinImage.onCompleteEvent -= OnCoinTweenComplete;
     }
 }
    private void CreateCoinImages()
    {
        m_coinImageInstances = new CoinImage[coinImageCount];
        Transform parent = coinImagePrefab.transform.parent;

        for (int i = 0; i < coinImageCount; i++)
        {
            GameObject inst = Instantiate(coinImagePrefab, parent);
            inst.SetActive(true);
            inst.transform.SetAsFirstSibling();

            CoinImage coinImage = inst.GetComponent <CoinImage>();
            coinImage.isStopOnCreated          = stopOnCreated;
            coinImage.delayOnCreatedTime       = createIntervalTime * i;
            coinImage.targetPointRectTransform = targetPointRectTransform;
            coinImage.onCompleteEvent         += OnCoinCreated;
            coinImage.onCompleteEvent         += OnCoinTweenComplete;

            m_coinImageInstances[i] = coinImage;
        }
    }
    /// <summary>
    /// 开始移动到目标点动画(必须 <see cref="stopOnCreated"/> 和 <see cref="m_isAllCoinsCreated"/> 为 true 时才能调用此方法)
    /// </summary>
    public void StartMoveToTargetAnimation()
    {
        if (!stopOnCreated)
        {
            return;
        }
        if (!m_isAllCoinsCreated)
        {
            Debug.LogError("必须所有币创建完成才能调用此方法");
            return;
        }

        for (int i = 0; i < coinImageCount; i++)
        {
            CoinImage coinImage = m_coinImageInstances[i];
            coinImage.StartMoveToTargetAnimation();
        }

        if (m_audioClip)
        {
            App.instance.audioManager.PlayEffect(m_audioClip, Camera.main.transform);
        }
    }