Esempio n. 1
0
    // ========================================================================== //

    #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(YieldManager.GetWaitForSecond(p_fUpdateDelaySec));
        }
    }
Esempio n. 2
0
        private void InitWorldContent()
        {
            //game data
            KeysRoot = new RootKey("root");

            YieldManager = new YieldManagerImpl(new Key(KeysRoot, "yield"));

            WFeatureBiome      = new YieldModifyingSSFR <TerrainBiome>(WorldType.World, new Key(KeysRoot, "tb"), false, TileYieldModifierPriority.Terrain);
            WFeatureVegetation = new YieldModifyingSMFR <TerrainVegetation>(WorldType.World, new Key(KeysRoot, "tv"), TileYieldModifierPriority.Terrain);
            WFeatureLandform   = new YieldModifyingSSFR <TerrainLandform>(WorldType.World, new Key(KeysRoot, "tl"), false, TileYieldModifierPriority.Terrain);

            //civs
            CivilizationManager = new CivilizationManager(new Key(KeysRoot, "civs"), 4);
        }
Esempio n. 3
0
    protected override IEnumerator OnEnableObjectCoroutine()
    {
        if (p_eConditionType.ContainEnumFlag(EConditionTypeFlags.OnUpdate) == false)
        {
            yield break;
        }

        while (true)
        {
            DoPlayEventTrigger();

            yield return(YieldManager.GetWaitForSecond(p_fUpdateTimeDelta));
        }
    }
Esempio n. 4
0
    private IEnumerator CoStartTween(bool bReset_Progress, ETweenDirection eTweenDirection, OnCreateYield OnCreatorYield, System.Func <float> OnGetDeltaTime)
    {
        if (p_fFirstDelaySec != 0f)
        {
            if (p_bIgnoreTimeScale)
            {
                yield return(new WaitForSecondsRealtime(p_fFirstDelaySec));
            }
            else
            {
                yield return(YieldManager.GetWaitForSecond(p_fFirstDelaySec));
            }
        }

        DoInitTween(eTweenDirection, bReset_Progress);

        //if (p_Event_OnStartTween_InCludeArg != null)
        //    p_Event_OnStartTween_InCludeArg(eTweenDirection, this);

        while (_bIsFinishForward == _bIsFinishRevese)
        {
            DoSetTweening(OnGetDeltaTime());

            CustomYieldInstruction pYield;
            OnCreatorYield(out pYield);

            yield return(pYield);
        }

        if (p_fAfterDelaySec != 0f)
        {
            if (p_bIgnoreTimeScale)
            {
                yield return(new WaitForSecondsRealtime(p_fAfterDelaySec));
            }
            else
            {
                yield return(YieldManager.GetWaitForSecond(p_fAfterDelaySec));
            }
        }

        //if (p_Event_OnFinishTween != null)
        //    p_Event_OnFinishTween.Invoke();

        //if (p_Event_OnFinishTween_InCludeArg != null)
        //    p_Event_OnFinishTween_InCludeArg(eTweenDirection, this);

        _bIsPlayingTween = false;
    }
Esempio n. 5
0
        protected IEnumerator MoveContents(int to)
        {
            if (!_contentsList.First().gameObject.activeSelf)
            {
                _contentsList.Add(_contentsList.First());
                _contentsList.RemoveAt(0);
            }
            var fromPosition  = new List <Vector2>();
            var fromSizeDelta = new List <Vector2>();

            for (var index = 0; index < _contentsList.Count; index++)
            {
                fromPosition.Add(CalculatePosition(index));
                fromSizeDelta.Add(CalculateSize(index));
            }

            _currentContent = to;

            var toPosition  = new List <Vector2>();
            var toSizeDelta = new List <Vector2>();

            for (var index = 0; index < _contentsList.Count; index++)
            {
                toPosition.Add(CalculatePosition(index));
                toSizeDelta.Add(CalculateSize(index));
            }

            for (var i = 0; i < 60 / _scrollSpeed; i++)
            {
                for (var index = 0; index < _contentsList.Count; index++)
                {
                    _contentsList[index].RectTransform.localPosition = Vector3.Lerp(fromPosition[index],
                                                                                    toPosition[index], i * ScrollSpeedPerFixedDeltaTime);
                    _contentsList[index].RectTransform.localScale = Vector3.Lerp(fromSizeDelta[index],
                                                                                 toSizeDelta[index], i * ScrollSpeedPerFixedDeltaTime);
                }

                yield return(YieldManager.GetWaitForFixedUpdate());
            }

            _action = null;
            ButtonActiveSet();
        }
Esempio n. 6
0
    /* protected - [abstract & virtual]         */


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

    #region Private

    IEnumerator CoTextAnimation()
    {
        do
        {
            _pStrBuilder.Length = 0;

            int iIndex = 0;
            while (iIndex < strAnimationText.Length)
            {
                _pStrBuilder.Append(strAnimationText[iIndex]);
                p_pTextComponent.text = _pStrBuilder.ToString();

                iIndex++;
                yield return(YieldManager.GetWaitForSecond(p_fDuration / strAnimationText.Length));
            }

            p_Event_OnFinishAnimation.DoNotify(this);
            yield return(null);
        } while (p_bIsLoop);
    }
    // ========================================================================== //

    /* public - [Do] Function
     * 외부 객체가 호출(For External class call)*/


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

    /* protected - Override & Unity API         */

    protected override IEnumerator OnEnableObjectCoroutine()
    {
        yield return(null);

        while (true)
        {
            Vector3 vecCurrentPos = transform.position;
            if (vecCurrentPos.Equals(_vecPosPrev) == false)
            {
                if (CheckDebugFilter(EDebugFilter.Debug_Level_Core))
                {
                    Debug.Log(name + ConsoleProWrapper.ConvertLog_ToCore(name + " Excute Trigger "), this);
                }

                p_listEvent.Invoke();
            }

            _vecPosPrev = vecCurrentPos;
            yield return(YieldManager.GetWaitForSecond(p_fUpdateTimeDelta));
        }
    }
        public IEnumerator Local_UDP_Connect_Session_Test()
        {
            Network_UDP_Test.EventMakeSingleton(true);
            Network_UDP_Test.instance.DoStartListen_UDP(iTestPort);

            // 세션이 하나도 없어야 한다.
            while (Network_UDP_Test.instance.p_mapNetworkSession.Count != 0)
            {
                yield return(YieldManager.GetWaitForSecond(.1f));
            }
            Assert.IsTrue(Network_UDP_Test.instance.p_mapNetworkSession.Count == 0, Network_UDP_Test.instance.p_mapNetworkSession.ToString());

            SPacketTest_Class pSendPacket = new SPacketTest_Class(2, "보냈다");

            Network_UDP_Test.instance.DoSendPacket(strTestTargetIP, iTestPort, pSendPacket);

            yield return(YieldManager.GetWaitForSecond(.05f));

            STestSession pSession = Network_UDP_Test.instance.p_mapNetworkSession.Values.First();

            DateTime pDateTime = DateTime.Now;
            float    fSecond   = pSession.GetLastConnectionTimeGap_Second(ref pDateTime);

            //Debug.Log("Last Connection Second :" + fSecond);

            Assert.IsTrue(pSession.p_eConnectionState == ENetworkConnectionState.새로접속 || pSession.p_eConnectionState == ENetworkConnectionState.연결중, pSession.p_eConnectionState.ToString());

            // 타임아웃보다 조금 더 기다린다.
            yield return(YieldManager.GetWaitForSecond(p_fTimeOutSecond + 0.5f));

            pDateTime = DateTime.Now;
            fSecond   = pSession.GetLastConnectionTimeGap_Second(ref pDateTime);
            Assert.IsTrue(pSession.p_eConnectionState == ENetworkConnectionState.연결잠시끊김, pSession.p_eConnectionState.ToString() + " Last Connection Second : " + fSecond);

            // 타임아웃에서 연결종료시간보다 조금 더 기다린다.
            yield return(YieldManager.GetWaitForSecond(p_fTimeDeleteSession - p_fTimeOutSecond + 0.5f));

            Assert.IsTrue(pSession.p_eConnectionState == ENetworkConnectionState.연결끊김, pSession.p_eConnectionState.ToString() + " Last Connection Second : " + fSecond);
        }
Esempio n. 9
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(YieldManager.GetWaitForSecond(0.1f));
        }

        if (bFadeOut)
        {
            DoPlaySound(_pAudioClipNext, _fVolumeNext);
            DoSetFadeIn();
        }
    }
    // ========================================================================== //

    /* protected - Override & Unity API         */

    protected IEnumerator PlaySpriteAnimation()
    {
        if (p_bIsPlay_OnEnable)
        {
            while (true)
            {
                while (true)
                {
                    bool bIsFinishAnimation = CalculateNextAnimation();

                    yield return(YieldManager.GetWaitForSecond(1 / p_fFPS));

                    if (bIsFinishAnimation && p_bIsLoop == false)
                    {
                        break;
                    }
                }

                OnFinishAnimation();
            }
        }
    }
Esempio n. 11
0
        IEnumerator CoUpdate_Enable_DisableTest()
        {
            bool bEnable = false;

            while (true)
            {
                yield return(YieldManager.GetWaitForSecond(1f));

                for (int i = 0; i < _listMonobehaviour.Count; i++)
                {
                    _listMonobehaviour[i].SetActive(bEnable);
                }

                yield return(YieldManager.GetWaitForSecond(1f));

                for (int i = 0; i < _listUpdateAble.Count; i++)
                {
                    _listUpdateAble[i].SetActive(bEnable);
                }

                bEnable = !bEnable;
            }
        }
Esempio n. 12
0
    protected override IEnumerator OnEnableObjectCoroutine()
    {
        if (_eColliderType == EColliderType.None)
        {
            yield break;
        }

        if (_bIs2D)
        {
            while (true)
            {
                yield return(YieldManager.GetWaitForSecond(p_fPhysicsCheckDelay));

                if (_bIsLock_CalculatePhysics)
                {
                    continue;
                }

                CalculatePhysics_2D(_OnGetHit());
            }
        }
        else
        {
            while (true)
            {
                yield return(YieldManager.GetWaitForSecond(p_fPhysicsCheckDelay));

                if (_bIsLock_CalculatePhysics)
                {
                    continue;
                }

                CalculatePhysics_3D(_OnGetHit());
            }
        }
    }
 public FeatureWorld(byte typesCount, YieldManager yieldManager)
 {
     _yieldManager = yieldManager;
     TypesCount    = typesCount;
     _tileSize     = new int[typesCount];
 }
Esempio n. 14
0
 public TerrainFeature(string name, StaticFeatureResolver <T> resolver, YieldManager yieldManager, YieldModifierType type, double[] modifiers) : base(name, resolver, yieldManager, type, modifiers, TileYieldModifierPriority.Terrain)
 {
 }
Esempio n. 15
0
        protected IEnumerator MoveContentsLoop(int dir)
        {
            var fromPosition  = new List <Vector2>();
            var fromSizeDelta = new List <Vector2>();

            for (var index = -MiddleContentIndex - 1; index <= MiddleContentIndex + 1; index++)
            {
                fromPosition.Add(CalculatePosition(index, true));
                fromSizeDelta.Add(CalculateSize(index, true));
            }

            if (dir != 1)
            {
                fromPosition.RemoveAt(fromPosition.Count - 1);
                fromSizeDelta.RemoveAt(fromSizeDelta.Count - 1);
            }
            else
            {
                fromPosition.RemoveAt(0);
                fromSizeDelta.RemoveAt(0);
            }

            _currentContent += dir;
            _currentContent  = (ContentDatas.Count + _currentContent) % ContentDatas.Count;

            var toPosition  = new List <Vector2>();
            var toSizeDelta = new List <Vector2>();

            for (var index = -MiddleContentIndex - 2; index <= MiddleContentIndex + 2; index++)
            {
                toPosition.Add(CalculatePosition(index + dir, true));
                toSizeDelta.Add(CalculateSize(index + dir, true));
            }

            if (dir != 1)
            {
                toPosition.RemoveRange(0, 3);
                toSizeDelta.RemoveRange(0, 3);

                if (!_contentsList.First().gameObject.activeSelf)
                {
                    var obj = _contentsList.First();
                    _contentsList.Remove(obj);
                    _contentsList.Add(obj);
                    obj.gameObject.SetActive(true);
                }
                else
                {
                    var obj = _contentsList.Last();
                    obj.gameObject.SetActive(true);
                }
            }
            else
            {
                toPosition.RemoveRange(toPosition.Count - 3, 3);
                toSizeDelta.RemoveRange(toSizeDelta.Count - 3, 3);

                if (!_contentsList.Last().gameObject.activeSelf)
                {
                    var obj = _contentsList.Last();
                    obj.gameObject.SetActive(true);
                }
                else
                {
                    var obj = _contentsList.First();
                    _contentsList.Remove(obj);
                    _contentsList.Add(obj);
                    obj.gameObject.SetActive(true);
                }
            }

            for (var i = -MiddleContentIndex + _currentContent; i <= MiddleContentIndex + _currentContent + 1; i++)
            {
                _contentsList.GetIndex(i + MiddleContentIndex - _currentContent + (dir < 0 ? 0 : dir))
                .SetContentData(ContentDatas.GetIndex(i));
            }
            ButtonActiveSet(MiddleContentIndex + (dir == 1 ? 0 : 1), true);

            for (var index = 0; index < _contentsList.Count; index++)
            {
                _contentsList[index].RectTransform.localPosition = fromPosition[index];
                _contentsList[index].RectTransform.localScale    = fromSizeDelta[index];
            }

            yield return(YieldManager.GetWaitForFixedUpdate());

            for (var i = 0; i < 60 / _scrollSpeed; i++)
            {
                for (var index = 0; index < _contentsList.Count; index++)
                {
                    _contentsList[index].RectTransform.localPosition = Vector3.Lerp(fromPosition[index],
                                                                                    toPosition[index], i * ScrollSpeedPerFixedDeltaTime);
                    _contentsList[index].RectTransform.localScale = Vector3.Lerp(fromSizeDelta[index],
                                                                                 toSizeDelta[index], i * ScrollSpeedPerFixedDeltaTime);
                }

                yield return(YieldManager.GetWaitForFixedUpdate());
            }

            _action = null;

            if (dir == 1)
            {
                _contentsList.First().gameObject.SetActive(false);
            }
            else
            {
                _contentsList.Last().gameObject.SetActive(false);
            }

            ButtonActiveSet(MiddleContentIndex + (dir == 1 ? 1 : 0));
        }
Esempio n. 16
0
 public AdditionYieldModifer(YieldManager manager, double[] modifiers) : base(manager, modifiers)
 {
 }
 public MultiplicationYieldModifier(YieldManager manager, double[] modifiers) : base(manager, modifiers)
 {
 }
 public MultiplicationYieldModifier(YieldManager manager) : base(manager, 1)
 {
 }
Esempio n. 19
0
 public AdditionYieldModifer(YieldManager manager) : base(manager, 0)
 {
 }
 public TerrainBiome(string name, StaticFeatureResolver <TerrainBiome> resolver, YieldManager yieldManager, YieldModifierType type, double[] modifiers) : base(name, resolver, yieldManager, type, modifiers)
 {
 }
    // ========================================================================== //

    /* public - [Do] Function
     * 외부 객체가 호출(For External class call)*/


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

    /* protected - Override & Unity API         */

    protected override IEnumerator OnEnableObjectCoroutine()
    {
        for (int i = 0; i < iTestCube_Count; i++)
        {
            GameObject pObjectBox = null;
            if (bIs2D)
            {
                pObjectBox = new GameObject();
                SpriteRenderer pSpriteRenderer = pObjectBox.AddComponent <SpriteRenderer>();
                pSpriteRenderer.sprite = pSprite_For2D;
                pObjectBox.AddComponent <BoxCollider2D>();

                pObjectBox.transform.localScale = Vector3.one * Random.Range(5f, 15f);
            }
            else
            {
                pObjectBox = GameObject.CreatePrimitive(PrimitiveType.Cube);
            }

            float fX = Random.Range(-fRandomPosition_Range_X, fRandomPosition_Range_X);
            float fY = Random.Range(-fRandomPosition_Range_Y, fRandomPosition_Range_Y);
            float fZ = Random.Range(-fRandomPosition_Range_Z, fRandomPosition_Range_Z);

            pObjectBox.transform.position = new Vector3(fX, fY, fZ);
            pObjectBox.transform.SetParent(transform);

            pObjectBox.AddComponent <CheckVisible_IVisibleListener_Test>();
            pObjectBox.name = i.ToString();

            _listRenderer.Add(pObjectBox.GetComponent <Renderer>());
        }

        yield return(YieldManager.GetWaitForSecond(0.5f));

        Update_CheckInVisibleGizmo(false);


        while (true)
        {
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                UpdateGizmo_Original();
                yield return(YieldManager.GetWaitForSecond(0.5f));

                Update_CheckInVisibleGizmo(false);
            }

            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                UpdateGizmo_Original();
                yield return(YieldManager.GetWaitForSecond(0.5f));

                Update_CheckInVisibleGizmo_UsePhysics();
            }

            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                UpdateGizmo_Original();
                yield return(YieldManager.GetWaitForSecond(0.5f));

                Update_CheckInVisibleGizmo_UsePhysics_2D();
            }

            yield return(null);
        }
    }
    // ========================================================================== //

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

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

        pEvent.pUnityComponent.enabled = pEvent.bEnable;
    }