Beispiel #1
0
        public static void EnqueStageTurningPoint(float tp, E_WhichTurn wt)
        {
            if (tp < Constants.turningTerm || wt == E_WhichTurn.NOT_TURN || tp < lastTurningPoint + Constants.turningTerm)
            {
                return;                                                                                                              //터닝 포인트 조건 충족 못함.
            }
            StageTurnPointSet tempTPS = new StageTurnPointSet(tp, wt);

            turningPointQueue.Enqueue(tempTPS);
            lastTurningPoint = tp;
        }
Beispiel #2
0
        void InitOfTurnPlan(StageTurnPointSet turnSet)
        {
            //터닝청크 생성
            TurnPartInCharge.GetInstance().GenerateTurnChunks(turnSet.whichTurn,
                                                              turnSet.ConvertTurnPointToRealTurnPoint(chunkMargin));

            //ui 쪽에 터닝포인트와 방향 알려줌
            if (mapTurnToUI != null)
            {
                mapTurnToUI.SetTurningPointToUI(turnSet.ConvertTurnPointToRealTurnPoint(chunkMargin));
                mapTurnToUI.SetWhichTurnToUI(turnSet.whichTurn);
            }
        }
Beispiel #3
0
        // Use this for initialization
        protected override void Awake()
        {
            base.Awake();
            chunkMargin    = chunk.GetComponentInChildren <Renderer>().bounds.size.z;
            chunkMarginDiv = 1 / chunkMargin;
            playerTr       = GameObject.FindGameObjectWithTag("PLAYER").transform;
            mapTurnToUI    = GameObject.Find("GameMgr").GetComponent <IMapTurnToUI>();

            nowPos = -100;

            turnSet = new StageTurnPointSet(-1, E_WhichTurn.NOT_TURN);
            turnSet.DisableThisSet();
            stageRemain = true;
        }
Beispiel #4
0
 public static StageTurnPointSet TurningGen(E_STAGE whatStage, float nowPos, float chunkMarginDiv, ref StageTurnPointSet turnSet)
 {
     if (StageST.turningPointQueue.Count == 0)
     {
         if (whatStage == E_STAGE.INFINITY)
         {
             InfinityFactory.GetInstance().MakeTurnSetQueNode(nowPos, chunkMarginDiv);
         }
         else
         {
             Debug.Log("맵 턴 큐 비었음.");
             turnSet.DisableThisSet();
             return(turnSet);
         }
     }
     return(StageST.turningPointQueue.Dequeue());
 }
Beispiel #5
0
        void Update()   //지금 랜덤 무한 생성 모드와 픽스드 모드를 어떻게 할지 결정해야하는데 고민이야.
        //변수 하나 받아와서 여기서 그냥 분기할까 클래스를 나눌까...
        {
            // newPos = GetPosByChunkMargin(); //코루틴으로 체크 부하를 줄임
            if (stageAllDone)
            {
                return;
            }

            if (isStage() && stageRemain == false)   //스테이지에서 더 생산 할 게 없음. 종료. 필요.
            {
                if (playerTr.position.z >= endingPoint + 2f)
                {
                    playerTr.gameObject.GetComponent <CharacterAnimation>().WinAnimation();
                    stageAllDone = true;
                }
                return;
            }

            if (newPos == nowPos)
            {
                return;//변화 없으면 리턴
            }
            nowPos = newPos;

            if (isStage() && StageST.AllQueIsDeqed() && turnSet.IsDisabled()) //회전도 다돌고 옵젝큐도 뭐도 없고 끝
            {
                Debug.Log("스테이지 종료." + nowPos);                               //프론트 청크 -1 만큼 청크가 앞에 있응 상황에서 선언됨
                stageRemain = false;

                endingPoint = nowPos + ((Constants.frontShowChunks - 1) * chunkMargin);
                StageEnding(nowPos);
                return;
            }

            if (turnSet.IsDisabled())     //회전이 끝났을때.
            {
                Debug.Log("맵턴큐 젠 시작");
                turnSet = MapPathGenerator.TurningGen(whatStage, nowPos, chunkMarginDiv, ref turnSet);
            }

            if (false == turnSet.IsDisabled() && turnSet.Init == false)
            {
                InitOfTurnPlan(turnSet);
                //터닝 초기화 부
                turnSet.Init = true;
            }


            if (turnSet.IsDisabled() == false)
            {
                tempCOSTList =
                    ChunkLoading.GetInstance().ChunkLoad(nowPos, turnSet.ConvertTurnPointToRealTurnPoint(chunkMargin));
                SetObjToNewChunks(tempCOSTList);
            }
            else    //옵젝큐만 남았거나 하는 상황.
            {
                tempCOSTList =
                    ChunkLoading.GetInstance().ChunkLoad(nowPos);
                SetObjToNewChunks(tempCOSTList);
            }

            WhenTurningFinished();
        }