Beispiel #1
0
        public void ChangeFSM(FSM_LAYER_ID eLayer, FSM_ID fsmID)
        {
            layerNum = (int)eLayer;

            if (!CurLayerCheck(eLayer))
            {
                UDL.LogWarning("Fail Change Layer : " + eLayer, nLogOption, warningLoglv);
                return;
            }

            if (!dicFSM_EachLayer[layerNum].TryGetValue(fsmID, out tFSMBuffer))
            {
                UDL.LogWarning(eLayer + " 에 " + fsmID + " 가 등록되어 있지 않습니다", nLogOption, warningLoglv);
                return;
            }

            if (CurLayerCheck(eLayer))
            {
                layerFSM_Buffer[layerNum] = curFSM_EachLayer[layerNum].fsmID;

                curFSM_EachLayer[layerNum].Pause();

                UnRegisterToFSM_ChangeLayerState(eLayer);

                curFSM_EachLayer[layerNum] = dicFSM_EachLayer[layerNum][fsmID];

                RegisterToFSM_ChangeLayerState(eLayer);

                curFSM_EachLayer[layerNum].Resume();
            }

            UDL.Log("(ChangeFSM) curFSM : " + curFSM_EachLayer[layerNum].fsmID.ToString(), nLogOption, logLv);
        }
        bool CurStateTransitionChk()
        {
            UDL.Log(fsmID + " CurStateTransitionChk", logOption, FSM.logLv);

            if (curState.arrTransitionList == null || curState.arrTransitionList.Length == 0)
            {
                UDL.LogWarning(fsmID + " No Transition List in curState", logOption, FSM.warningLoglv);
            }

            if (curState.arrTransitionList != null)
            {
                for (int idx = 0; idx < curState.arrTransitionList.Length; idx++)
                {
                    if (curState.arrTransitionList[idx].ConditionCheck(this))
                    {
                        UDL.Log(fsmID + " ConditionCheck Pass : "******"/ " + curState.eID, logOption, FSM.logLv);

                        TransitionStart(curState.arrTransitionList[idx].eTransID, curState.arrTransitionList[idx].nextStateID);
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #3
0
    public IEnumerator PopupTest()
    {
        AsyncOperation async = SceneManager.LoadSceneAsync("WorkingScene");

        while (!async.isDone)
        {
            yield return(null);
        }

        GameObject.Instantiate(Resources.Load("UIPrefab/Overlay Canvas"));

        yield return(null);

        bool popupShow = true;

        System.Action <bool> callback = (result) =>
        {
            UDL.LogWarning("Callback");
            popupShow = false;
        };
        EMC_MAIN.Inst.NoticeEventOccurrence(EMC_CODE.POPUP, "Title", "Content Message", 0, callback);

        while (popupShow)
        {
            yield return(null);
        }
    }
        public bool ConditionCheck(FSM pFSM)
        {
            if (transitionWithTime == null)
            {
                if (arrTransParam.Count == 0)
                {
                    UDL.LogWarning("전이 조건이 없습니다. // FSM ID : " + pFSM.fsmID.ToString() + " / " + "CurrentState : "
                                   + pFSM.GetCurState().eID + " / OwnerState : "
                                   + "/ TransID : " + eTransID.ToString(), FSM.logOption, FSM.warningLoglv);

                    return(false);
                }
            }

            bCheckCondResult = true;

            // &연산 true&true=true / true&false=false / false&false = false

            if (transitionWithTime != null)
            {
                bCheckCondResult &= transitionWithTime.TimeConditionChk();
            }

            foreach (TransCondWithParam t in arrTransParam)
            {
                bCheckCondResult &= t.ConditionCheck(pFSM);
            }


            return(bCheckCondResult);
        }
        public void AddTransition(TransitionCondition value)
        {
            TransitionCondition[] tempArr;

            if (arrTransitionList == null)
            {
                tempArr    = new TransitionCondition[1];
                tempArr[0] = value;
            }
            else
            {
                for (int idx = 0; idx < arrTransitionList.Length; idx++)
                {
                    if (value.eTransID != 0 && arrTransitionList[idx].eTransID == value.eTransID)
                    {
                        UDL.LogWarning("동일한 전이 ID를 추가합니다", FSM.logOption, FSM.warningLoglv);
                    }
                }

                tempArr = new TransitionCondition[arrTransitionList.Length + 1];

                for (int i = 0; i < arrTransitionList.Length; i++)
                {
                    tempArr[i] = arrTransitionList[i];
                }

                tempArr[arrTransitionList.Length] = value;
            }

            arrTransitionList = tempArr;

            value.SetOwnerForTimeCond(this);
        }
        bool BoolTypeConditionChk(bool value, FSM pFSM)
        {
            if (!pFSM.dicBoolParam.TryGetValue(m_uiParamID, out bParamBuffer))
            {
                UDL.LogError(m_uiParamID.ToString() + ". 등록되지 않은 Trans_Param_ID 입니다. ", FSM.logOption, FSM.errorLoglv);
            }

            switch (m_eCompOperator)
            {
            case TransitionComparisonOperator.LESS:
            case TransitionComparisonOperator.GREATER:
            case TransitionComparisonOperator.OVER:
            case TransitionComparisonOperator.UNDER:
                UDL.LogWarning("bool 변수에 잘못된 조건연산자를 지정했음", FSM.logOption, FSM.warningLoglv);
                return(false);

            case TransitionComparisonOperator.EQUALS:
                if (bParamBuffer == value)
                {
                    return(true);
                }
                break;

            case TransitionComparisonOperator.NOTEQUAL:
                if (bParamBuffer != value)
                {
                    return(true);
                }
                break;
            }

            return(false);
        }
        bool FloatTypeCondtionChk(float value, FSM pFSM)
        {
            if (!pFSM.dicFloatParam.TryGetValue(m_uiParamID, out fParamBuffer))
            {
                UDL.LogError(m_uiParamID.ToString() + ". 등록되지 않은 Trans_Param_ID 입니다. ", FSM.logOption, FSM.errorLoglv);
            }

            switch (m_eCompOperator)
            {
            case TransitionComparisonOperator.EQUALS:

                UDL.LogWarning("float 변수는 Equal 조건을 만족시키지 못 할 위험이 있습니다. ", FSM.logOption, FSM.warningLoglv);

                if (fParamBuffer == value)
                {
                    return(true);
                }
                break;

            case TransitionComparisonOperator.NOTEQUAL:
                UDL.LogWarning("float 변수는 NotEqual 조건을 사용하면 정확하지 않을 위험이 있습니다. ", FSM.logOption, FSM.warningLoglv);

                if (fParamBuffer != value)
                {
                    return(true);
                }
                break;

            case TransitionComparisonOperator.GREATER:
                if (fParamBuffer >= value)
                {
                    return(true);
                }
                break;

            case TransitionComparisonOperator.LESS:
                if (fParamBuffer <= value)
                {
                    return(true);
                }
                break;

            case TransitionComparisonOperator.OVER:
                if (fParamBuffer > value)
                {
                    return(true);
                }
                break;

            case TransitionComparisonOperator.UNDER:
                if (fParamBuffer < value)
                {
                    return(true);
                }
                break;
            }

            return(false);
        }
        void OwnerStart(TRANS_ID transID, STATE_ID stateid, STATE_ID preStateID)
        {
            fStartTime     = UnityEngine.Time.realtimeSinceStartup;
            fPauseTIme     = 0;
            fPauseInterval = 0;

            UDL.LogWarning("TransCondWithTime Owner Start // current :" + stateid.ToString() + " / " + fStartTime.ToString() + " / pre : " + preStateID + " / transID : " + transID + " / hashcode : " + this.GetHashCode(), FSM.logOption, FSM.warningLoglv);
        }
 public void SetBool_NoCondChk(TRANS_PARAM_ID param_id, bool value)
 {
     if (!dicBoolParam.TryGetValue(param_id, out bParamBuffer))
     {
         UDL.LogWarning(((FSM_ID)fsmID).ToString() + " not have given Transition parameter id. ", logOption, FSM.warningLoglv);
     }
     else
     {
         dicBoolParam[param_id] = value;
     }
 }
        public bool TimeConditionChk()
        {
            if (UnityEngine.Time.realtimeSinceStartup - fStartTime - fPauseInterval >= m_fConditionTimeValue)
            {
                UDL.LogWarning("CurrentTime : " + Time.realtimeSinceStartup + " // State start time : " + fStartTime
                               + " // pause interval : " + fPauseInterval + " // condition time : " + m_fConditionTimeValue, FSM.logOption, FSM.warningLoglv);

                return(true);
            }

            return(false);
        }
    public override void Excute(int _nExcuteId)
    {
        if (uAnim != null && uAnim.isActiveAndEnabled)
        {
            UDL.LogWarning(gameObject.name + " Excute ID : " + _nExcuteId, nLogOption, bIsDebug, nLogWarningLevel);
            aniStateBuffer = -1;
            uAnim.SetInteger("idx", _nExcuteId);
            uAnim.SetTrigger("go");

            LogCurAnimInfo("Excute");
        }
    }
Beispiel #12
0
 bool CurLayerCheck(FSM_LAYER_ID eLayer)
 {
     if (curFSM_EachLayer[(int)eLayer] == null)
     {
         UDL.LogWarning(eLayer + " 지정한 레이어에 FSM이 지정되 있지 않음", nLogOption, warningLoglv);
         return(false);
     }
     else
     {
         return(true);
     }
 }
        public void SetFloat(TRANS_PARAM_ID param_id, float value)
        {
            if (!dicFloatParam.TryGetValue(param_id, out fParamBuffer))
            {
                UDL.LogWarning(((FSM_ID)fsmID).ToString() + " not have given Transition parameter id. ", logOption, FSM.warningLoglv);
                return;
            }

            dicFloatParam[param_id] = value;

            RequestTransitionChk();
        }
        void TransitionStart(TRANS_ID transParamID, STATE_ID nextStateID)
        {
            triggerID = TRANS_PARAM_ID.TRIGGER_NONE;

            if (!IsActive)
            {
                UDL.Log(fsmID + " Refuse TransitionStart", logOption, FSM.logLv);
                return;
            }

            if (nextStateID == STATE_ID.HistoryBack)
            {
                HistoryBack();
                return;
            }

            if (!dicStateList.TryGetValue(nextStateID, out tStateBuffer))
            {
                UDL.LogError(nextStateID.ToString() + " 등록된 씬이 아님!", logOption, FSM.errorLoglv);
                return;
            }

            calldepth++;

            if (calldepth > 1)
            {
                UDL.LogWarning(fsmID + " FSM Call Depth is : " + calldepth
                               + " // 재귀호출구조가 되면서 EvnetStateChange callback이 현재 상태만을 매개변수로 역순으로 반복호출됩니다. ", logOption, FSM.warningLoglv);
            }

            UDL.Log(fsmID + " Transition Start// " + curState.eID + " -> "
                    + dicStateList[nextStateID].eID + " // " + transParamID, logOption, FSM.logLv);

            STATE_ID preStateID = curState.eID;

            curState.End(transParamID, nextStateID);

            if (!curState.NoHistory)
            {
                history.Push(curState.eID);
            }

            curState = dicStateList[nextStateID];

            curState.Start(transParamID, preStateID);

            if (EventStateChange != null)
            {
                EventStateChange(transParamID, curState.eID, preStateID);
            }

            calldepth--;
        }
    IEnumerator RecoverAnimatorState()
    {
        yield return(true);

        if (uAnim != null)
        {
            if (aniStateBuffer != -1 && aniStateBuffer != unShowStateHash)
            {
                UDL.LogWarning(gameObject.name + " aniStateBuffer : " + aniStateBuffer, nLogOption, bIsDebug, nLogWarningLevel);
                uAnim.Play(aniStateBuffer);
                LogCurAnimInfo("RecoverAnimatorState");
            }
        }
    }
        public void AddState(State newState)
        {
            if (newState.eID == STATE_ID.AnyState)
            {
                UDL.LogWarning("AnyState(Code_AnyState) 는 이미 생성되어 있습니다. ", logOption, FSM.warningLoglv);
            }

            if (dicStateList.ContainsKey(newState.eID))
            {
                UDL.LogError("ID가 겹침 " + newState.eID.ToString());
                return;
            }

            dicStateList.Add(newState.eID, newState);
        }
    private void LogCurAnimInfo(string prefix)
    {
        AnimatorStateInfo state = uAnim.GetCurrentAnimatorStateInfo(0);

        AnimatorClipInfo[] clip = uAnim.GetCurrentAnimatorClipInfo(0);

        string clipInfo = "";

        foreach (var item in clip)
        {
            clipInfo += item.clip.name + " / " + item.weight;
        }

        UDL.LogWarning(gameObject.name + " // " + prefix + " // " + state.shortNameHash + "\n" + clipInfo, nLogOption, bIsDebug);
    }
Beispiel #18
0
        public void RemoveFSM(FSM_LAYER_ID eLayer, FSM_ID id)
        {
            layerNum = (int)eLayer;
            if (dicFSM_EachLayer[layerNum].ContainsKey(id))
            {
                dicFSM_EachLayer[layerNum].Remove(id);
            }
            else
            {
                UDL.LogWarning("가지고 있지 않은 FSM을 삭제하려 함", nLogOption, warningLoglv);
            }

            if (curFSM_EachLayer[layerNum].fsmID == id)
            {
                curFSM_EachLayer[layerNum] = null;
            }
        }
Beispiel #19
0
        public void AddFSM(FSM_LAYER_ID eLayer, FSM newFSM, FSM_ID id = FSM_ID.NONE)
        {
            layerNum = (int)eLayer;
            if (dicFSM_EachLayer.Length <= layerNum)
            {
                UDL.LogError("할당되지 않은 레이어를 호출하고 있습니다 Layer 및 iMaxLayer를 확인해주세요", nLogOption, errorLoglv);
                return;
            }

            if (dicFSM_EachLayer[layerNum] == null)
            {
                dicFSM_EachLayer[layerNum] = new Dictionary <FSM_ID, FSM>();
            }

            if (id != FSM_ID.NONE)
            {
                if (dicFSM_EachLayer[layerNum].ContainsKey(id))
                {
                    UDL.LogWarning("동일 레이어에 중복된 FSM ID 를 등록하려함!", nLogOption, warningLoglv);
                }
                else
                {
                    newFSM.SetFSMID(id);
                }
            }

            dicFSM_EachLayer[layerNum].Add(newFSM.fsmID, newFSM);

            UDL.Log(eLayer + " // add : " + newFSM.fsmID, nLogOption, logLv);

            if (curFSM_EachLayer[layerNum] == null)
            {
                curFSM_EachLayer[layerNum] = newFSM;

                RegisterToFSM_ChangeLayerState(eLayer);

                curFSM_EachLayer[layerNum].Resume();
            }
            else
            {
                ChangeFSM(eLayer, newFSM.fsmID);
            }
        }
        void AnyStateTransitionChk()
        {
            UDL.Log(fsmID + " AnyStateTransitionChk", logOption, FSM.logLv);

            if (anyState.arrTransitionList == null || anyState.arrTransitionList.Length == 0)
            {
                UDL.LogWarning(fsmID + " No Transition List in AnyState", logOption, FSM.errorLoglv);
            }
            else
            {
                for (int idx = 0; idx < anyState.arrTransitionList.Length; idx++)
                {
                    if (anyState.arrTransitionList[idx].ConditionCheck(this))
                    {
                        TransitionStart(anyState.arrTransitionList[idx].eTransID, anyState.arrTransitionList[idx].nextStateID);
                        break;
                    }
                }
            }
        }
Beispiel #21
0
        public void RegisterEventChangeLayerState(FSM_LAYER_ID eLayer, deleStateTransEvent _deleFunc)
        {
            layerNum = (int)eLayer;
            if (layerNum >= iMaxLayer)
            {
                UDL.LogError("할당 되지 않은 레이어를 호출했습니다", nLogOption, errorLoglv);
                return;
            }

            if (!dicLayerChangeState.ContainsKey(eLayer))
            {
                dicLayerChangeState.Add(eLayer, new List <deleStateTransEvent>());
            }

            dicLayerChangeState[eLayer].Add(_deleFunc);

            int result = RegisterToFSM_ChangeLayerState(eLayer);

            if (result == 1)
            {
                UDL.LogWarning(eLayer + " " + errMsgAbout_Register_ChangeLayerState[result] + " // 이 후 해당 레이어에 ChangeFSM이 호출 될 때 반영될 수 있습니다. ", nLogOption, warningLoglv);
            }
        }
Beispiel #22
0
    protected override void OnDataChange()
    {
        base.OnDataChange();

        if (bindedData.Value < 0)
        {
            UDL.LogWarning("fillamount range over");
            img.fillAmount = 0;
        }
        else if (bindedData.Value > 1)
        {
            UDL.LogWarning("fillamount range over");
            img.fillAmount = 1;
        }

        if (reverse)
        {
            img.fillAmount = 1 - bindedData.Value;
        }
        else
        {
            img.fillAmount = bindedData.Value;
        }
    }
        public void SetTransID(TRANS_ID id)
        {
            eTransID = id;

            UDL.LogWarning("Set trans ID : " + eTransID, FSM.logOption, FSM.warningLoglv);
        }