public void VideoUnlockScene(UnlockAnimCallback callback = null) { if (null == _sceneLock) { return; } VideoUnlock(_sceneLock.gameObject, callback); }
public void VideoUnlock(GameObject itemLock, UnlockAnimCallback callback = null, bool hasParticle = true, bool hasMusic = true) { if (null == itemLock) { return; } RectTransform itemLockImage = itemLock.transform.Find("ItemLockImage").GetComponent <RectTransform> (); if (null == itemLockImage) { return; } //Particle2DSystem particle = null; //if (hasParticle) { // particle = Instantiate (Resources.Load<Particle2DSystem> ("UnlockParticle")); // particle.transform.SetParent (itemLock.transform); // particle.transform.localPosition = Vector3.zero; // particle.transform.localScale = itemLockImage.localScale; //} if (hasMusic) { UIManager.PlaySoundUnlock(); } Sequence seq = DOTween.Sequence(); seq.PrependInterval(0.5f); seq.Append(itemLockImage.DOScale(new Vector3(0f, 0f, 1f), 1f).SetEase(Ease.InBack)); seq.OnComplete(() => { //if (null != particle) { // Destroy (particle.gameObject); //} Destroy(itemLockImage.gameObject); if (null != itemLock.GetComponent <Image> ()) { itemLock.GetComponent <Image> ().raycastTarget = false; } if (null != callback) { callback(itemLock); } }); }