Ejemplo n.º 1
0
    // Use this for initialization
    IEnumerator Start()
    {
        alpha = 0;
        stormmaterial.material.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, alpha));
        yield return(Yielders.GetWaitForSeconds(Random.Range(8, 15)));

        particle.SetActive(true);
        alpha = 0.0001f;
        while (alpha > 0)
        {
            alpha += Time.deltaTime * speed;
            stormmaterial.material.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, alpha));

            if (AI_Player.isFinish == true)
            {
                alpha = 0;
                stormmaterial.material.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, alpha));

                yield break;
            }
            yield return(null);
        }

        particle.SetActive(false);

        yield return(Start());
    }
Ejemplo n.º 2
0
    public IEnumerator Init1()
    {
        transform.localEulerAngles = new Vector3(0, startAngle, 0);
        for (int i = 0; i < angleSpan.Length; i++)
        {
            yield return(Yielders.WaitSecond(delaySpan));

            float   tempAngle = (startAngle + angleSpan[i]);
            float   x1        = 1 * Mathf.Cos(tempAngle * Mathf.PI / 180);
            float   z1        = 1 * Mathf.Sin(tempAngle * Mathf.PI / 180);
            Vector3 moveDir   = new Vector3(x1, 0, z1).normalized;

            if (parent != null && target != null && target.isLive)
            {
                GameObject obj = Common.Generate(prefab, transform);
                obj.transform.position = parent.transform.position;
                //obj.transform.eulerAngles = new Vector3(0, 0, tempAngle);
                BulletMove bMove = obj.GetComponent <BulletMove>();
                bMove.SetEulerAngle(new Vector3(0, 0, startAngle + angleSpan[i]));
                Tag   myTag = Tag.Bullet;
                float atk   = 0;
                if (cardInfo != null)
                {
                    myTag = cardInfo.myTag;
                    atk   = cardInfo.Atk;
                }
                bMove.Init(myTag, atk, moveDir * moveSpeed);
            }
        }
    }
Ejemplo n.º 3
0
    private IEnumerator RoutineMethod1()
    {
        Debug.Log("Routine Method 1");
        yield return(Yielders.Seconds(0.1f));

        yield return(null);
    }
Ejemplo n.º 4
0
    IEnumerator MoveVertical(int rbegin, int rfinish, LTDescr movetween)
    {
        yield return(null);

        while (rbegin < rfinish)
        {
            rbegin++;
            rowCr     = rbegin;
            movetween = LeanTween.moveLocalY(currentPieces,
                                             VectorRowFinish(rowCr), speedMoveVertical).setOnComplete(() => {
                movetween = null;
            });
            yield return(Yielders.Get(speedMoveVertical));
        }
        if (PiecesControl.instance.piece1 != 0)
        {
            int piece = PiecesControl.instance.piece1;
            MatrixControl.instance.AddPieceInMatrix(pieces_default[piece], piece, rowCr, colCr);
        }
        if (PiecesControl.instance.piece2 != 0)
        {
            int piece = PiecesControl.instance.piece2;
            MatrixControl.instance.AddPieceInMatrix(pieces_default[piece], piece, rowCr - 1, colCr);
        }
        if (PiecesControl.instance.piece3 != 0)
        {
            int piece = PiecesControl.instance.piece3;
            MatrixControl.instance.AddPieceInMatrix(pieces_default[piece], piece, rowCr - 2, colCr);
        }
    }
    IEnumerator Level()
    {
        if (!AI_Player.isGameing || AI_Player.isFinish == true)
        {
            yield break;
        }
        yield return(Yielders.GetWaitForSeconds(Random.Range(0.25f, 0.5f)));

        int key      = Random.Range(0, 10);
        int position = Mathf.Clamp(Random.Range(-1, 2), -1, 1);

        if (key > 2)
        {
            Instantiate(rockPool, new Vector3(position * GameData.Instance.moveXOffect, 0, GameData.Instance.generateStartZ), Quaternion.identity);
        }
        else if (key == 0)
        {
            Instantiate(fishPool, new Vector3(position * GameData.Instance.moveXOffect, 0, GameData.Instance.generateStartZ), Quaternion.identity);
        }
        else if (key == 1)
        {
            Instantiate(HoldFish, new Vector3(position * GameData.Instance.moveXOffect, 0.2f, GameData.Instance.generateStartZ), Quaternion.Euler(90, 0, 0));
        }
        else if (key == 2)
        {
            Instantiate(HoldUchi, new Vector3(position * GameData.Instance.moveXOffect, 0.2f, GameData.Instance.generateStartZ), Quaternion.Euler(90, 0, 0));
        }
        yield return(Level());
    }
Ejemplo n.º 6
0
    private IEnumerator DoubleSatiety()
    {
        isDoubleSatiety = true;
        yield return(Yielders.Get(_doubleSatietyTime));

        isDoubleSatiety = false;
    }
    IEnumerator SkillButtonTimer()
    {
        yield return(Yielders.Get(m_skillTime));

        m_skillbtnCheck = true;
        BattleSpriteAction.GetInstance.m_emotion = MOTIONCHECK.E_IDLE;
    }
    IEnumerator DoActionDealCards(float _timeDelay)
    {
        System.TimeSpan _tmpDeltaTime = dragonTigerCasinoData.nextTimeToShowResult - System.DateTime.Now;
        if (_tmpDeltaTime.TotalSeconds <= 5)
        {
            cardDragon = LeanPool.Spawn(cardPrefab, cardDragonDealPlaceHolder.position, Quaternion.identity, panelCardContainer).GetComponent <PanelCardDetailController>();
            cardDragon.transform.position = cardDragonDealPlaceHolder.position;
            cardDragon.ResizeAgain(100, 150f);
            cardTiger = LeanPool.Spawn(cardPrefab, cardTigerDealPlaceHolder.position, Quaternion.identity, panelCardContainer).GetComponent <PanelCardDetailController>();
            cardTiger.transform.position = cardTigerDealPlaceHolder.position;
            cardTiger.ResizeAgain(100, 150f);
        }
        else
        {
            cardDragon = LeanPool.Spawn(cardPrefab, Vector3.zero, Quaternion.identity, panelCardContainer).GetComponent <PanelCardDetailController>();
            cardDragon.transform.position = posistionSpawnCard;
            cardDragon.ResizeAgain(100, 150f);
            cardTiger = LeanPool.Spawn(cardPrefab, Vector3.zero, Quaternion.identity, panelCardContainer).GetComponent <PanelCardDetailController>();
            cardTiger.transform.position = posistionSpawnCard;
            cardTiger.ResizeAgain(100, 150f);
            yield return(Yielders.Get(_timeDelay));

            yield return(CoroutineChain.Start
                         .Sequential(
                             cardDragon.Move(cardDragonDealPlaceHolder.position, 0.3f, LeanTweenType.easeOutSine, myAudioInfo.sfx_DealCard),
                             cardTiger.Move(cardTigerDealPlaceHolder.position, 0.3f, LeanTweenType.easeOutSine, myAudioInfo.sfx_DealCard)));
        }
    }
Ejemplo n.º 9
0
    IEnumerator DoActionDealGlobalCard(List <sbyte> _valueCards)
    {
        List <ICardInfo> _tmpListCardInfo             = new List <ICardInfo>();
        ICardInfo        _cardInfo                    = null;
        List <PanelCardDetailController> _tmpListCard = new List <PanelCardDetailController>();
        PanelCardDetailController        _card        = null;

        for (int i = 0; i < _valueCards.Count; i++)
        {
            _cardInfo = Poker_GamePlay_Manager.instance.GetCardInfo(_valueCards[i]);
            if (_cardInfo == null)
            {
                                #if TEST
                Debug.LogError("_cardInfo is NULL : " + _valueCards[i]);
                                #endif
                continue;
            }
            _tmpListCardInfo.Add(_cardInfo);

            _card = LeanPool.Spawn(cardPrefab, Vector3.zero, Quaternion.identity, Poker_GamePlay_Manager.instance.panelCardContainer).GetComponent <PanelCardDetailController>();
            _card.transform.position = placeHolder_SpawnCard_Catched.position;
            _card.ResizeAgain(Poker_GamePlay_Manager.instance.sizeCard.x, Poker_GamePlay_Manager.instance.sizeCard.y);
            _tmpListCard.Add(_card);
        }
        yield return(Yielders.Get(0.1f));

        for (int i = 0; i < _tmpListCard.Count; i++)
        {
            CoroutineChain.Start
            .Sequential(_tmpListCard[i].Move(placeHolder_GlobalCards_Catched[globalCardsPoolManager.listObjects.Count].position, 0.1f, LeanTweenType.easeOutSine, Poker_GamePlay_Manager.instance.CanPlayMusicAndSfx() ? Poker_GamePlay_Manager.instance.myAudioInfo.sfx_DealCard : null)
                        , _tmpListCard[i].Show(_tmpListCardInfo[i]));
            globalCardsPoolManager.AddObject((MySimplePoolObjectController)_tmpListCard[i]);
            yield return(Yielders.Get(0.1f));
        }
    }
Ejemplo n.º 10
0
    private IEnumerator RotatePlayerCoroutine(int id)
    {
        Quaternion targetRotation = Quaternion.Euler(0f, (id * rotationAmount), 0f);

        float speed = 3f;
        float time  = 1 * speed;

        float counter = 0f;

        float totalRotation = (id * rotationAmount) - player.transform.eulerAngles.y;

        if (totalRotation < 0)
        {
            totalRotation += 360;
        }

        float rotationTick = (totalRotation * (time / 100f));

        while (true)
        {
            counter += time / 100f;

            player.transform.Rotate(Vector3.up * rotationTick);

            if (counter >= 1f)
            {
                player.transform.rotation = targetRotation;
                break;
            }

            yield return(Yielders.Get(0.01f));
        }

        KickBall();
    }
    IEnumerator DoActionCheckFocusIconGetGold()
    {
        if (!btnShop.activeSelf)
        {
            actionCheckFocusIconGetGold = null;
            yield break;
        }
        while (true)
        {
            if (dragonTigerCasinoData == null || !dragonTigerCasinoData.hasLoadGameInfo)
            {
                yield return(null);

                continue;
            }
            if (btnShop.activeSelf)
            {
                if (DataManager.instance.userData.GetGoldView() <= 0)
                {
                    arrowFocusGetGold.Show();
                }
                else
                {
                    arrowFocusGetGold.Hide();
                }
            }
            yield return(Yielders.Get(1f));
        }
    }
    private IEnumerator ModLoop()
    {
        this.CreateModWarning();
        yield return(Yielders.Seconds(5f));

        for (;;)
        {
            yield return(Yielders.Seconds(10f));

            this._WarningTxt.DOFade(0f, 1f);
            yield return(Yielders.Seconds(1f));

            this._WarningTxt.text = "UNOFFICIAL\nCONTENT";
            this._WarningTxt.DOFade(1f, 1f);
            yield return(Yielders.Seconds(6f));

            this._WarningTxt.DOFade(0f, 1f);
            yield return(Yielders.Seconds(1f));

            this._WarningTxt.text = "MODDED\nGAME";
            this._WarningTxt.DOFade(1f, 1f);
            yield return(Yielders.Seconds(1f));
        }
        yield break;
    }
Ejemplo n.º 13
0
    private IEnumerator YuLeiSpan()
    {
        yield return(Yielders.WaitSecond(yuStartDelay));

        for (int i = 0; i < yuLeiCount; i++)
        {
            yield return(Yielders.WaitSecond(yuSpanDelay));

            float   angle    = Random.Range(0, 360);
            float   x1       = fightRadius * Mathf.Cos(angle * Mathf.PI / 180);
            float   z1       = fightRadius * Mathf.Sin(angle * Mathf.PI / 180);
            Vector3 endPoint = fightPoint + new Vector3(x1, 0, z1) * Random.Range(0f, 1f);

            float tempAngle = -90;
            //
            GameObject obj = Common.Generate(prefab, transform);
            obj.transform.SetParent(transform.parent);
            obj.transform.position = endPoint;

            BulletMove bMove = obj.GetComponent <BulletMove>();
            bMove.SetEulerAngle(new Vector3(0, 0, tempAngle));
            Tag   myTag = Tag.Bullet;
            float atk   = 0;
            if (cardInfo != null)
            {
                myTag = cardInfo.myTag;
                atk   = cardInfo.Atk;
            }
            bMove.Init(myTag, atk, Vector3.down * moveSpeed);
        }
    }
Ejemplo n.º 14
0
 public Form1()
 {
     InitializeComponent();
     Load       += Form1_Load;
     FormClosed += Form1_FormClosed;
     Yielders.RegisterYielder <MyYielder>("MyYielder");
 }
Ejemplo n.º 15
0
    //Show retry station after a delay
    IEnumerator ShowRetryRoutine()
    {
        yield return(Yielders.WaitForSeconds(Constants.SECOND_DELAY));

        //Show retry station
        GUI_Handler.Instance.GUI_ShowRetry();
    }
Ejemplo n.º 16
0
    IEnumerator DoActionDealPlayerCard(Poker_PlayerGroup _playerGroup)
    {
        List <PanelCardDetailController> _tmpListCard = new List <PanelCardDetailController>();
        PanelCardDetailController        _card        = null;

        for (int i = 0; i < 2; i++)
        {
            _card = LeanPool.Spawn(cardPrefab, Vector3.zero, Quaternion.identity, Poker_GamePlay_Manager.instance.panelCardContainer).GetComponent <PanelCardDetailController>();
            _card.transform.position = placeHolder_SpawnCard_Catched.position;
            _card.ResizeAgain(Poker_GamePlay_Manager.instance.sizeCard.x, Poker_GamePlay_Manager.instance.sizeCard.y);
            _tmpListCard.Add(_card);
        }

        yield return(Yielders.Get(0.1f));

        for (int i = 0; i < _tmpListCard.Count; i++)
        {
            if (!_playerGroup.isMe)
            {
                if (Poker_GamePlay_Manager.instance.CanPlayMusicAndSfx())
                {
                    MyAudioManager.instance.PlaySfx(Poker_GamePlay_Manager.instance.myAudioInfo.sfx_DealCard);
                }
                CoroutineChain.Start
                .Parallel(_tmpListCard[i].Move(_playerGroup.cardCoverHoldersCatched[i].position, 0.1f, LeanTweenType.easeOutSine)
                          , _tmpListCard[i].Rotate(_playerGroup.cardCoverHoldersCatched[i].rotation.eulerAngles, 0.1f)
                          , _tmpListCard[i].ScaleTo(_playerGroup.cardCoverHoldersCatched[i].localScale, 0.1f, LeanTweenType.notUsed));
            }
            else
            {
                ICardInfo _cardInfo = null;

                for (int j = 0; j < pokerGamePlayData.listPlayerPlayingData.Count; j++)
                {
                    if (pokerGamePlayData.listPlayerPlayingData[j].isMe &&
                        pokerGamePlayData.listPlayerPlayingData[j].userData.IsEqual(_playerGroup.userData))
                    {
                        _cardInfo = Poker_GamePlay_Manager.instance.GetCardInfo(pokerGamePlayData.listPlayerPlayingData[j].ownCards[i]);
                        if (_cardInfo == null)
                        {
                                                        #if TEST
                            Debug.LogError("_cardInfo is NULL : " + pokerGamePlayData.listPlayerPlayingData[j].ownCards[i]);
                                                        #endif
                            continue;
                        }
                        break;
                    }
                }

                CoroutineChain.Start
                .Parallel(_tmpListCard[i].Move(_playerGroup.ownCardHoldersCatched[i].position, 0.1f, LeanTweenType.easeOutSine
                                               , Poker_GamePlay_Manager.instance.CanPlayMusicAndSfx() ? Poker_GamePlay_Manager.instance.myAudioInfo.sfx_DealCard : null)
                          , _tmpListCard[i].Rotate(_playerGroup.ownCardHoldersCatched[i].rotation.eulerAngles, 0.1f)
                          , _tmpListCard[i].ScaleTo(_playerGroup.ownCardHoldersCatched[i].localScale, 0.1f, LeanTweenType.notUsed))
                .Sequential(_tmpListCard[i].Show(_cardInfo));
            }
            _playerGroup.ownCardPoolManager.AddObject(_tmpListCard[i]);
            yield return(Yielders.Get(0.1f));
        }
    }
    private IEnumerator PlayMultipleMessageCoroutine(string message)
    {
        Transform   mmTransform   = multipleMessage.transform;
        CanvasGroup mmCanvasGroup = multipleMessage.gameObject.GetComponent <CanvasGroup>();

        multipleMessage.gameObject.SetActive(true);

        multipleMessage.text   = message;
        mmTransform.localScale = new Vector3(1f, 1f, 1f);
        mmCanvasGroup.alpha    = 1f;

        float counter = 0f;

        while (true)
        {
            counter += Time.deltaTime;

            Vector3 scale = mmTransform.localScale;
            scale += new Vector3(Time.deltaTime, Time.deltaTime, Time.deltaTime);
            mmTransform.localScale = scale;

            mmCanvasGroup.alpha -= Time.deltaTime;

            if (counter >= 1f)
            {
                break;
            }

            yield return(Yielders.Get(0.01f));
        }

        multipleMessage.gameObject.SetActive(false);
    }
Ejemplo n.º 18
0
    private IEnumerator TimeDown()
    {
        Debugger.Log(" IEnumerator TimeDown()");

        soundTime = 0;
        while (soundTime < RECORD_TIME - 4)
        {
            if (!Microphone.IsRecording(null))
            {             //如果没有录制
                Debugger.Log("IsRecording false");
                yield break;
            }
            //Debugger.Log("yield return Yielders.GetWaitForSeconds {0}", soundTime);

            WWW www = SendHttpToSoundServer(idx);
            idx++;
            yield return(www);

            yield return(Yielders.GetWaitForSeconds(1));

            if (www != null)
            {
                www.Dispose();
            }
            soundTime++;
        }
        if (soundTime >= RECORD_TIME - 4)
        {
            Debugger.Log("RECORD_TIME is out! stop record!");
            ChatVoiceService.Instance.EndRecordSound(true);
        }
        yield return(0);
    }
    IEnumerator NormalAttackTimer()
    {
        yield return(Yielders.Get(m_normalAttackTime));

        m_normalAttackCheck = true;
        BattleSpriteAction.GetInstance.m_emotion = MOTIONCHECK.E_IDLE;
    }
Ejemplo n.º 20
0
    private IEnumerator RotateOpponentCoroutine()
    {
        float finalRotation = opponent.transform.eulerAngles.y + calloutDegree;

        float rotationSpeed = 3f;
        float count         = 0f;

        while (true)
        {
            count += 0.01f * rotationSpeed;

            ballReceiver.rotation = Quaternion.Lerp(ballReceiver.rotation, Quaternion.Euler(0f, finalRotation, 0f), count);

            opponent.transform.Rotate(Vector3.up * calloutDegree * 0.01f * rotationSpeed);
            degreeText.text = opponent.transform.eulerAngles.y.ToString("F0");

            if (count >= 1f)
            {
                opponent.transform.eulerAngles = new Vector3(0, finalRotation, 0);
                degreeText.text = opponent.transform.eulerAngles.y.ToString("F0");
                break;
            }

            yield return(Yielders.Get(0.01f));
        }

        CheckSuccess();
    }
    private IEnumerator MoveCameraCoroutine(Transform targetPos, bool playing)
    {
        float     speed        = 1f;
        float     time         = 1 / speed;
        Transform camTransform = Camera.main.transform;

        float counter = 0f;

        while (true)
        {
            counter += time / 100f;

            camTransform.position = Vector3.Lerp(camTransform.position, targetPos.position, counter);
            camTransform.rotation = Quaternion.Lerp(camTransform.rotation, targetPos.rotation, counter);

            if (counter >= 1f)
            {
                break;
            }

            yield return(Yielders.Get(0.01f));
        }

        SetAllPointsActive();

        if (playing)
        {
            calloutText.gameObject.SetActive(true);
        }
        else
        {
            RestartGame();
        }
    }
Ejemplo n.º 22
0
        private IEnumerator WaitThenCheck()
        {
            yield return(Yielders.WaitForSeconds(0.2f));

            BaseAnimator.SetBool(HasContentsState, CurrentSlot.Occupant);
            yield break;
        }
Ejemplo n.º 23
0
    public IEnumerator DoActionHit(float _time)
    {
        yield return(Yielders.Get(_time));

        subState = SubState.None;
        ResetPiecesOfBody();
    }
Ejemplo n.º 24
0
 private IEnumerator PlayEmoji(SceneDialogueConfig cfg)
 {
     m_playStep = PlaySetp.playEmojy;
     if (cfg != null)
     {
         if (cfg.Direction == 0)
         {
             if (cfg.Emotion > 0)
             {
                 m_Emoji1.gameObject.SetActive(true);
                 m_Emoji1.SetIndexSprite((int)cfg.Emotion - 1);
             }
         }
         else
         {
             if (cfg.Emotion > 0)
             {
                 m_Emoji2.gameObject.SetActive(true);
                 m_Emoji2.SetIndexSprite((int)cfg.Emotion - 1);
             }
         }
         yield return(Yielders.GetWaitForSeconds(waitShowDialogTime));
     }
     else
     {
         yield return(null);
     }
 }
Ejemplo n.º 25
0
    private IEnumerator KickBallCoroutine()
    {
        yield return(Yielders.Get(0.5f));

        while (true)
        {
            float stepCam  = 5.0f * Vector3.Distance(Camera.main.transform.position, endCameraPosition) * 0.01f;
            float stepBall = Mathf.Min(5.0f * Vector3.Distance(ball.transform.position, ballEndPoint) * 0.02f, 2f);

            Camera.main.transform.position = Vector3.MoveTowards(Camera.main.transform.position, endCameraPosition, stepCam);
            ball.transform.position        = Vector3.MoveTowards(ball.transform.position, ballEndPoint, stepBall);

            if (Vector3.Distance(ball.transform.position, ballEndPoint) <= 1f)
            {
                break;
            }

            yield return(Yielders.Get(0.01f));
        }

        if (scoredGoal)
        {
            KickBallIntoGoal();
        }
        else
        {
            KickBallAwayFromGoal();
        }
    }
Ejemplo n.º 26
0
    private IEnumerator DoOption(Animator ani, uint dialogID)
    {
        // 选择过需等待动画播放哦。
        if (m_IsPlayOptionSeleteAni == true)
        {
            yield return(Yielders.GetWaitForSeconds(1.0f));
        }
        m_IsPlayOptionSeleteAni = true;
        if (ani != null)
        {
            ani.SetTrigger("Selected");
        }
        yield return(Yielders.GetWaitForSeconds(1.0f));

        m_IsPlayOptionSeleteAni = false;
        SceneDialogueConfig cfg = SceneDialogueDao.Inst.GetCfg(dialogID);

        if (cfg != null)
        {
            StartCoroutine(Play(m_curCofig, cfg, 0, false, true));
            m_curCofig = cfg;
        }
        else
        {
            // StartCoroutine(Play(m_curCofig, null, 0, false, true));
            // m_curCofig = null;
        }
    }
Ejemplo n.º 27
0
    public IEnumerator Init2()
    {
        yield return(Yielders.WaitSecond(delayYuLei));

        for (int i = 0; i < yuLeiAngle.Length; i++)
        {
            float   posAngle    = startAngle + (i * 360 / yuLeiAngle.Length);
            float   x1          = radius * Mathf.Cos(posAngle * Mathf.PI / 180);
            float   z1          = radius * Mathf.Sin(posAngle * Mathf.PI / 180);
            Vector3 setPosition = new Vector3(x1, 0, z1);

            float   lookAngle = startAngle + yuLeiAngle[i];
            float   x2        = radius * Mathf.Cos(lookAngle * Mathf.PI / 180);
            float   z2        = radius * Mathf.Sin(lookAngle * Mathf.PI / 180);
            Vector3 moveDir   = new Vector3(x2, 0, z2).normalized;

            if (parent != null && target != null && target.isLive)
            {
                GameObject obj = Common.Generate(prefab2, transform);
                obj.transform.position  = parent.transform.position;
                obj.transform.position += setPosition;
                //obj.transform.eulerAngles = new Vector3(0, 0, startAngle + yuLeiAngle[i]);
                BulletMove bMove = obj.GetComponent <BulletMove>();
                bMove.SetEulerAngle(new Vector3(0, 0, lookAngle));
                Tag   myTag = Tag.Bullet;
                float atk   = 0;
                if (cardInfo != null)
                {
                    myTag = cardInfo.myTag;
                    atk   = cardInfo.Atk;
                }
                bMove.Init(myTag, atk, moveDir * moveSpeed2);
            }
        }
    }
Ejemplo n.º 28
0
    private IEnumerator KickBallToPointCoroutine(Vector3 pos, bool success)
    {
        yield return(Yielders.Get(0.5f));

        float     speed         = 2f;
        float     time          = 1 * speed;
        Transform ballTransform = ball.transform;
        float     step          = (Vector3.Distance(ballTransform.position, pos) / 100f) * speed;

        Vector3 dir = (pos - ballTransform.position).normalized;

        float counter = 0f;

        while (true)
        {
            counter += time / 100f;

            ballTransform.position = Vector3.MoveTowards(ballTransform.position, pos, step);

            if (counter >= 1f)
            {
                break;
            }

            yield return(Yielders.Get(0.01f));
        }

        counter = 0f;
        if (!success)
        {
            calloutText.text = "OOPS!";

            step = (Vector3.Distance(ballTransform.position, pos + dir * 50f) / 100f) * speed;

            while (true)
            {
                counter += time / 100f;

                ballTransform.position = Vector3.MoveTowards(ballTransform.position, pos + dir * 50f, step);

                if (counter >= 1f)
                {
                    break;
                }

                yield return(Yielders.Get(0.01f));
            }
        }
        else
        {
            calloutText.text = "NICE BLOCK!";
            Vector3 forceToAdd = Camera.main.transform.forward + new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), 0f);
            ball.GetComponent <Rigidbody>().AddForce(forceToAdd * 50f, ForceMode.Impulse);
        }


        yield return(Yielders.Get(1f));

        RestartGame();
    }
Ejemplo n.º 29
0
    IEnumerator WaitForJoin()
    {
        ClearRoomList();

        int countdown = 10;

        while (countdown > 0)
        {
            status.text = "Joining... (" + countdown + ")";
            yield return(Yielders.Get(1f));

            countdown--;
        }

        // If it reaches here it means it failed to connect
        status.text = "Connection Timeout. Failed to connect.";
        yield return(Yielders.Get(1f));

        MatchInfo matchInfo = networkManager.matchInfo;

        if (matchInfo != null)
        {
            networkManager.matchMaker.DropConnection(matchInfo.networkId, matchInfo.nodeId, 0, networkManager.OnDropConnection);
            networkManager.StopHost();
        }

        RefreshRoomList();
        refreshCoroutine = StartCoroutine(RefreshRoomListCoroutine());
    }
Ejemplo n.º 30
0
    IEnumerator DoActionTestAAAA()
    {
        while (true)
        {
            yield return(Yielders.Get(2f));

            Debug.Log("-----------------------------");
            long         _currentMilisecond = MyConstant.currentTimeMilliseconds;
            List <sbyte> _cards             = new List <sbyte>();
            yield return(StartCoroutine(videoPokerGamePlayData.FirstTime_GetCardsResult_PAIR((_cardsResult) => {
                _cards = _cardsResult;
            })));

            for (int i = 0; i < _cards.Count; i++)
            {
                for (int j = 0; j < listCardDetail.Count; j++)
                {
                    if (_cards[i] == listCardDetail[j].cardId)
                    {
                        Debug.Log(">>> " + listCardDetail[j].cardInfo.cardType.ToString());
                    }
                }
            }
            Debug.Log(MyConstant.currentTimeMilliseconds - _currentMilisecond);
        }
    }