/// <summary>
        /// 이벤트 없이 상태전이를 바로 한다.
        /// </summary>
        /// <param name="_event">새로운 상태</param>
        public bool ChangeState(STATE _state)
        {
            if (isEntering)
            {
                Debug.LogWarning(string.Format("Current : {0}", Current_State));
                Debug.LogWarning("current state is already entering!");
                return(false);
            }

            //현재 상태와 동일 할경우
            if (Current_State.Equals(_state))
            {
                return(false);
            }

            //< 해당 상태가 없을경우 패스
            if (!StateMap.ContainsKey(_state))
            {
                return(false);
            }

            isEntering = true;
            StateMap[Current_State].OnExit(delegate()
            {
                Current_State = _state;
                StateMap[Current_State].OnEnter(delegate()
                {
                    isEntering = false;
                });
            });

            return(true);
        }
Exemple #2
0
    private void Update_Progress()
    {
        if (deleting_old)
        {
            float entity_list_value = 5.0f;
            float current           = deletion_index + (entities_deleted ? entity_list_value : 0.0f);
            float max      = chunks.Count + entity_list_value;
            float progress = current / max;
            ProgressBarManager.Instance.Show(string.Format("Clearing map... {0}%", Helper.Float_To_String(100.0f * progress, 1)), progress);
            return;
        }
        if (Current_State == State.Generating)
        {
            float  loop_1_current = chunks.Count;
            float  loop_2_current = second_loop_count;
            float  loop_3_current = third_loop_count;
            float  chunk_count    = (float)Initial_Chunk_Size_X * (float)Initial_Chunk_Size_Z;
            float  progress       = (loop_1_current + loop_2_current + loop_3_current) / (chunk_count * 3.0f);
            string message        = "Generating map";
            switch (generation_loop)
            {
            case 0:
                message = "Generating terrain";
                break;

            case 1:
                message = "Fine tuning terrain";
                break;

            case 2:
                message = "Fine tuning details";
                break;
            }
            ProgressBarManager.Instance.Show(string.Format("{0}... {1}%", message, Helper.Float_To_String(100.0f * progress, 1)), progress);
        }
        else if (Current_State == State.Saving)
        {
            float progress = chunks_processed / (float)chunks.Count;;
            ProgressBarManager.Instance.Show(string.Format("Saving... {0}%", Helper.Float_To_String(100.0f * progress, 1)), progress);
        }
        else if (Current_State == State.Loading)
        {
            float progress = chunks_processed / (float)SaveManager.Instance.Chunks_Loaded;;
            ProgressBarManager.Instance.Show(string.Format("Loading... {0}%", Helper.Float_To_String(100.0f * progress, 1)), progress);
        }
        else
        {
            CustomLogger.Instance.Error(string.Format("State = {0}", Current_State.ToString()));
        }
    }