// ========================================================================== //

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoPattern_Line()
    {
        _iGenerateRemainCount = Random.Range(_iGenerateCount_Min, _iGenerateCount_Max);
        if (_iMuzzleCount != 1)
        {
            while (_bIsGenerating && _iGenerateRemainCount-- > 0)
            {
                // 좌측부터 기울어진 상태에서 시작
                int     iStartGap   = (_iMuzzleCount / 2);
                Vector3 vecStartPos = -_vecPosGap;
                float   fStartAngle = _fAngleMuzzle * -iStartGap;
                for (int i = 0; i < _iMuzzleCount; i++)
                {
                    Vector3 vecPosGap   = _pTransformCached.position + vecStartPos;
                    Vector3 vecAngleGap = _pTransformCached.rotation.eulerAngles + new Vector3(0f, 0f, fStartAngle);

                    ProcShotGenerate(vecPosGap, Quaternion.Euler(vecAngleGap));
                    fStartAngle += _fAngleMuzzle;
                    vecStartPos += (Vector3)_vecPosGap;
                }
                yield return(SCManagerYield.GetWaitForSecond(_fDelaySec_Generate));
            }
        }
        else
        {
            yield return(StartCoroutine(CoGenerateSomthing()));
        }
    }
    private IEnumerator CoPattern_Sprial()
    {
#if NGUI
        CNGUITweenRotationSpin pTweenRotate = GetTweenRotate();

        Vector3 vecCurrentRotation = transform.rotation.eulerAngles;
        pTweenRotate.from = vecCurrentRotation;
        pTweenRotate.to   = new Vector3(0f, 0f, vecCurrentRotation.z + 360f);
        //pTweenRotate.duration = _fTweenDuration;

        //if (_fAngleRotate > 0f)
        //	pTweenRotate.PlayForward();
        //else
        //{
        //	pTweenRotate.ResetToFactor(1f);
        //	pTweenRotate.PlayReverse();
        //}

        float fAngleGap = 360 / _iMuzzleCount;
        float fAngle    = 0;

        while (_bIsGenerating && _iGenerateRemainCount-- > 0)
        {
            for (int i = 0; i < _iMuzzleCount; i++)
            {
                ProcShotGenerate(transform.position, Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(0f, 0f, fAngle)));
                fAngle += fAngleGap;
            }

            yield return(SCManagerYield.GetWaitForSecond(_fDelaySec_Generate));
        }
#endif
        yield return(null);
    }
Example #3
0
    protected IEnumerator CoDelayAction(System.Action OnAfterDelayAction, float fDelaySec)
    {
        yield return(SCManagerYield.GetWaitForSecond(fDelaySec));

        OnAfterDelayAction();
        _mapCoroutinePlaying.Remove(OnAfterDelayAction);
    }
    private IEnumerator CoDelayActionEventTrigger(System.Action OnAfterDelayAction, float fDelaySec)
    {
        yield return(SCManagerYield.GetWaitForSecond(fDelaySec));

        yield return(new CYield_IsWaitingEventTrigger());

        OnAfterDelayAction();
    }
    // ========================================================================== //

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoDelayDisable()
    {
        yield return(SCManagerYield.GetWaitForSecond(fAutoDisableTime));

        gameObject.SetActive(false);
        if (_OnDisable != null)
        {
            _OnDisable(gameObject);
        }
    }
    // ========================================================================== //

    #region Private

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoUpdateTexture()
    {
        while (true)
        {
            yield return(new WaitForEndOfFrame());

            System.IntPtr pTexturePointer = _pRenderTexture.GetNativeTexturePtr();
            _pTextureCopy.UpdateExternalTexture(pTexturePointer);

            yield return(SCManagerYield.GetWaitForSecond(p_fUpdateDelaySec));
        }
    }
Example #7
0
    private IEnumerator CoGenerateSomthing(Vector3 vecPosGap, Vector3 vecAngleGap)
    {
        while (_bIsLoop || _iGenerateRemainCount > 0)
        {
            if (_bIsGenerating)
            {
                _iGenerateRemainCount--;
                ProcShotGenerate(_pTransformCached.position + vecPosGap, Quaternion.Euler(_pTransformCached.rotation.eulerAngles + vecAngleGap));
            }

            yield return(SCManagerYield.GetWaitForSecond(_fDelaySec_Generate * _fAdjust_GenerateDelay));
        }
    }
Example #8
0
    private IEnumerator CoGenerateSomthing()
    {
        while (_bIsLoop || _iGenerateRemainCount > 0)
        {
            if (_bIsGenerating)
            {
                _iGenerateRemainCount--;
                ProcShotGenerate(_pTransformCached.position, _pTransformCached.rotation);
            }

            yield return(SCManagerYield.GetWaitForSecond(_fDelaySec_Generate * _fAdjust_GenerateDelay));
        }
    }
    private IEnumerator CoGenerateSomthing()
    {
        while (_bIsLoop || _iGenerateRemainCount > 0)
        {
            if (_bIsGenerating)
            {
                _iGenerateRemainCount--;
                ProcShotGenerate(transform.position, transform.rotation);
            }

            float fDelaySecRandom = Random.Range(_fDelaySec_GenerateMin, _fDelaySec_Generate_Max);
            yield return(SCManagerYield.GetWaitForSecond(fDelaySecRandom));
        }
    }
    private IEnumerator CoGenerateSomthing(Vector3 vecPosGap, Vector3 vecAngleGap)
    {
        while (_bIsLoop || _iGenerateRemainCount > 0)
        {
            if (_bIsGenerating)
            {
                _iGenerateRemainCount--;
                ProcShotGenerate(transform.position + vecPosGap, Quaternion.Euler(transform.rotation.eulerAngles + vecAngleGap));
            }

            float fDelaySecRandom = Random.Range(_fDelaySec_GenerateMin, _fDelaySec_Generate_Max);
            yield return(SCManagerYield.GetWaitForSecond(fDelaySecRandom));
        }
    }
Example #11
0
    // ========================================================================== //

    /* private - [Proc] Function
     * 중요 로직을 처리                         */

    private IEnumerator CoUpdatePathFinding()
    {
        while (true)
        {
            Vector3 vecPos = _pTransformCached.position;
            vecPos.y = _fRayHeight;

            bool bHitRaySomthing = false;
            for (int i = 0; i < _listRayDirection.Count; i++)
            {
                Vector3 vecDirection = _pTransformCached.TransformDirection(_listRayDirection[i]);
                _arrRayHit[i] = Physics.Raycast(vecPos, vecDirection, _fRayDistance);

                if (_arrRayHit[i] && bHitRaySomthing == false)
                {
                    bHitRaySomthing = true;
                }
            }


            Vector3 vecDestDirection = Vector3.forward;
            if (bHitRaySomthing)
            {
                for (int i = 0; i < _listRayDirection.Count; i++)
                {
                    if (_arrRayHit[i] == false)
                    {
                        vecDestDirection = _listRayDirection[i];

                        if (i == 0)
                        {
                            _pTransformCached.Translate(Vector3.forward * fSpeed, Space.Self);
                        }

                        break;
                    }
                }
            }
            else
            {
                vecDestDirection = pTransTarget.position - _pTransformCached.position;
                _pTransformCached.Translate(Vector3.forward * fSpeed, Space.Self);
            }

            Quaternion quatTarget = Quaternion.LookRotation(vecDestDirection);
            _pTransformCached.rotation = Quaternion.RotateTowards(_pTransformCached.rotation, quatTarget, fSpeedRotate);

            yield return(SCManagerYield.GetWaitForSecond(_fUpdateTime));
        }
    }
Example #12
0
    // ========================== [ Division ] ========================== //

    private IEnumerator ProcStart(System.Action <ShowResult> OnEndAD)
    {
        if (Advertisement.isSupported)
        {
            Advertisement.Initialize(strGameID);
        }

        while (Advertisement.isInitialized == false || Advertisement.IsReady() == false)
        {
            yield return(SCManagerYield.GetWaitForSecond(0.5f));
        }

        _pShowOption.resultCallback = OnEndAD;
        Advertisement.Show(null, _pShowOption);
    }
    // ========================================================================== //

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoUpdateSpawnAuto()
    {
        int iLoopCount = 0;

        while (true)
        {
            DoPlaySpawnSomthing(_iDifficulty_OnAuto);
            if (iLoopCount++ > _iIncreaseCondition_LoopCount)
            {
                iLoopCount           = 0;
                _iDifficulty_OnAuto += _iIncreaseDifficulty;
            }
            yield return(SCManagerYield.GetWaitForSecond(_fSpawnDelay));
        }
    }
Example #14
0
    // ========================================================================== //

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoUpdateSpawnAuto()
    {
        int iLoopCount = 0;

        while (true)
        {
            DoPlaySpawnSomthing(_iDifficulty_OnAuto);
            if (_bIsAutoIncreseDifficulty && iLoopCount++ > _iIncreaseCondition_LoopCount)
            {
                iLoopCount           = 0;
                _iDifficulty_OnAuto += _iIncreaseDifficulty;
            }

            float fRandomDelay = Random.Range(_fSpawnDelay_Min, _fSpawnDelay_Max) * _fDelayOffset;
            yield return(SCManagerYield.GetWaitForSecond(fRandomDelay));
        }
    }
    private IEnumerator CoPattern_Circle()
    {
        int iPlayCountOnCircle = _PlayCount_OnCircle;

        while (_bIsGenerating && iPlayCountOnCircle-- > 0)
        {
            Vector3 vecCurrentPos = transform.position;
            float   fAngleGap     = 360 / _iGenerateRemainCount;
            float   fAngle        = 0;
            for (int i = 0; i < _iGenerateRemainCount; i++)
            {
                ProcShotGenerate(vecCurrentPos, Quaternion.Euler(new Vector3(0f, 0f, fAngle)));
                fAngle += fAngleGap;
            }

            yield return(SCManagerYield.GetWaitForSecond(_fDelaySec_Generate));
        }
    }
Example #16
0
    // ===================================== //
    // private - [Other] Function            //
    // 찾기, 계산 등의 비교적 단순 로직      //
    // ===================================== //

    private IEnumerator CoPlayFadeInOut(bool bFadeOut)
    {
        float fDestVolume = bFadeOut ? 0f : _fVolume;

        _pAudioSource.volume = bFadeOut ? _fVolume : 0f;

        float fFadeProgress = 0f;

        while (fFadeProgress < 1f)
        {
            _pAudioSource.volume = Mathf.Lerp(_pAudioSource.volume, fDestVolume, fFadeProgress);
            fFadeProgress       += 0.1f;
            yield return(SCManagerYield.GetWaitForSecond(0.1f));
        }

        if (bFadeOut)
        {
            DoPlaySound(_pAudioClipNext, _fVolumeNext);
            DoSetFadeIn();
        }
    }
Example #17
0
    private IEnumerator CoPlayPattern(bool bIsLoop)
    {
        if (bIsLoop)
        {
            while (true)
            {
                if (gameObject.activeSelf)
                {
                    OnPatternPlay();
                    StartCoroutine(CoLookAtTarget());
                    yield return(StartCoroutine(_pPattern()));

                    yield return(SCManagerYield.GetWaitForSecond(_fDelaySec_Pattern));

                    OnPatternStop();
                }
            }
        }
        else
        {
            _iPlayCountCurrent = _iPlayCount_Pattern;
            while (_iPlayCountCurrent-- > 0)
            {
                if (gameObject.activeSelf)
                {
                    OnPatternPlay();
                    StartCoroutine(CoLookAtTarget());
                    yield return(StartCoroutine(_pPattern()));

                    yield return(SCManagerYield.GetWaitForSecond(_fDelaySec_Pattern));

                    OnPatternStop();
                }
            }
        }
    }
Example #18
0
    protected IEnumerator CoDisableObject(GameObject pObjectDisable, float fDelaySec)
    {
        yield return(SCManagerYield.GetWaitForSecond(fDelaySec));

        pObjectDisable.SetActive(false);
    }
Example #19
0
    protected IEnumerator CoDelayAction(System.Action OnAfterDelayAction, float fDelaySec)
    {
        yield return(SCManagerYield.GetWaitForSecond(fDelaySec));

        OnAfterDelayAction();
    }
    // ========================================================================== //

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoDelayAction(SEnableComponentEvent pEvent)
    {
        yield return(SCManagerYield.GetWaitForSecond(pEvent.fDelayTimeSec));

        pEvent.pUnityComponent.enabled = pEvent.bEnable;
    }