IEnumerator ExecuteCheckPubbleDepth() { //如果当该泡泡预备状态不是normal的时候,开始检测深度 while (preparePubbleState != PreParePubbleState.PREPARE_NORMAL_STATE) { if (preparePubbleState == PreParePubbleState.PREPARE_FIRST_STATE) { gameObject.GetComponent<UISprite>().depth = showDepthValue; } else { gameObject.GetComponent<UISprite>().depth = normalDepthValue; //修改为普通状态则不再进行该操作 preparePubbleState = PreParePubbleState.PREPARE_NORMAL_STATE; } //等待0.5s yield return new WaitForSeconds(0.1f); } yield return null; }
public void SetOrginPubbleDepth() { preparePubbleState = PreParePubbleState.PREPARE_SECOND_STATE; }
/* * @brief 现在泡泡 用Sprite显示,在创建预备泡泡的时候便于显示提高depth,成为发射泡泡的时候,修改回原来的depth */ public void SetShowPubbleDepth() { preparePubbleState = PreParePubbleState.PREPARE_FIRST_STATE; StartCoroutine(ExecuteCheckPubbleDepth()); }