Example #1
0
    public void CheckBarricade(ref Action act)
    {
        // 위치
        int loc = act.count;

        if (act.progress == ActionProgress.Ready)
        {
            Debug.LogWarning("오브젝트 습득 :: 액션 위치 = " + act.count);

            // 오브젝트 : 초기화
            objectPickUpList.Clear();
            objectPickUpStep = ActionProgress.Ready;


            //// 아이템 : 초기화
            //itemList.Clear();
            //isPickingUpItem = false;
            //itemFinish = false;

            //// 이벤트 : 초기화
            //eventList.Clear();
            //isPickingUpEvent = false;
            //eventFinish = false;

            // 스킵
            act.progress = ActionProgress.Start;
        }
        else if (act.progress == ActionProgress.Start)
        {
            // 초기화
            objectPickUpList.Clear();

            // 위치의 오브젝트 목록 가져오기
            List <DynamicObject> localBarricade = DynamicObject.objectList[loc];

            // 오브젝트 : 리스트 작성
            for (int i = 0; i < localBarricade.Count; i++)
            {
                DynamicObject obj = localBarricade[i];

                // 획득 조건 충족
                if (obj.CheckCondition(owner))
                {
                    // 획득 대기열 추가
                    objectPickUpList.Add(obj);

                    // 로그
                    Debug.LogWarning(string.Format("{0} 오브젝트 :: 습득 목록 추가 => ", obj.type, obj.transform.name));

                    continue;
                }
                else
                {
                    Debug.LogWarning(string.Format("{0} 오브젝트 :: 습득 자격 미달 => ", obj.type, obj.transform.name));
                }
            }

            // 스킵
            act.progress = ActionProgress.Working;
        }
        else if (act.progress == ActionProgress.Working)
        {
            // 오브젝트 : 습득
            if (objectPickUpStep == ActionProgress.Ready)
            {
                objectPickUp = StartCoroutine(GetObject());
            }


            // 완료 체크
            //if (itemFinish && eventFinish)
            if (objectPickUpStep == ActionProgress.Finish)
            {
                // 스킵
                objectPickUpStep = ActionProgress.Ready;
                act.progress     = ActionProgress.Finish;
            }
        }
        else if (act.progress == ActionProgress.Finish)
        {
            // 종료 처리
            act.isFinish = true;
        }
    }