예제 #1
0
        void InitMapST()
        {
            BossMapST bst;
            float     startPoint = -1 * Constants.wantToShowNumOfChunksInBehind;

            for (int i = 0; i < Constants.wantToShowNumOfChunks; i++)
            {
                bst = new BossMapST();

                GameObject chunk =
                    MapAndObjPool.GetInstance().GetChunkInPool();

                if (chunk == null)
                {
                    ErrorManager.SpurtError("청크가 널임");
                }
                if (startPoint == 0)
                {
                    chunk.transform.position = Vector3.zero;
                }
                else
                {
                    chunk.transform.position = Vector3.forward * (startPoint * chunkMargin);
                }

                bst.chunk = chunk;
                bst.chunk.SetActive(true);
                startPoint++;

                mapSTList.Add(bst);
            }
        }
예제 #2
0
        private void Update()
        {
            if (Input.GetKeyDown("p"))
            {
                BossPatternGenerator.GetInstance().BossPatternObjGen(E_BOSSPATTERN.METEOR, 100, E_SPAWNLINE.CENTER);

                BossPatternGenerator.GetInstance().BossPatternObjGen(E_BOSSPATTERN.METEOR, 100, E_SPAWNLINE.LEFT);

                BossPatternGenerator.GetInstance().BossPatternObjGen(E_BOSSPATTERN.METEOR, 100, E_SPAWNLINE.RIGHT);


                BossPatternGenerator.GetInstance().BossPatternObjGen(E_BOSSPATTERN.BREATH, 50, E_SPAWNLINE.CENTER);

                BossPatternGenerator.GetInstance().BossPatternObjGen(E_BOSSPATTERN.BREATH, 50, E_SPAWNLINE.LEFT);

                BossPatternGenerator.GetInstance().BossPatternObjGen(E_BOSSPATTERN.BREATH, 50, E_SPAWNLINE.RIGHT);
            }
            if (Input.GetKeyDown("x"))
            {
                GameObject t =
                    MapAndObjPool.GetInstance().GetBossObsFireBallInPool();
                t.transform.position = new Vector3(-10, 10, 100);
                t.SetActive(true);
            }
            //패턴 따라 넣어주는 처리.

            if (!stop)
            {
                mapSTList.MoveAllInList(moveSpeed);
                BossChunkLoading();
            }
        }
예제 #3
0
        public void ChangeObj(int objNum, E_SPAWN_OBJ_TYPE changingType)
        {
            if (floorChunk == null)
            {
                ErrorManager.SpurtError("생성도 안됐는데 오브젝트를 바꾸려함.");
            }

            if (false == UpperHuddleCheck(objNum, changingType, soa))
            {
                Debug.Log("어퍼허들 체크에서 삑살.");
                return;
            }

            if (whichTurn != E_WhichTurn.NOT_TURN)
            {
                Debug.Log("회전 청크인데 오브젝트를 체인지 하려고함.");
                return;
            }

            for (int i = 0; i < objs.Count; i++)
            {
                if (objs[i] != null)
                {
                    MapAndObjPool.GetInstance().TurnInPoolObj(objs[i]);
                }
            }
            objs.Clear();//참조만 날라감. 괜찮음.

            soa.spawnObjType[objNum] = changingType;

            spg = floorChunk.transform.GetChild(3);

            FixedObjGenerator.FixedObjGen(spg, soa.spawnObjType, ref objs);
        }
예제 #4
0
 private void Start()
 {
     MapAndObjPool.GetInstance().ChunkPoolInit(Constants.wantToShowNumOfChunks);
     MapAndObjPool.GetInstance().bossObsBreathPoolInit();
     MapAndObjPool.GetInstance().bossObsFireBallPoolInit();
     MapAndObjPool.GetInstance().bossObsMeteorPoolInit();
     InitMapST();
 }
예제 #5
0
 public void TurnInObjs()
 {
     for (int i = 0; i < objs.Count; i++)
     {
         MapAndObjPool.GetInstance().TurnInPoolObj(objs[i]);
     }
     objs.Clear();
 }
예제 #6
0
        public void ChangeFloor(E_WhichTurn whichTurn)    //그냥 청크면 낙턴으로 보내줄것.
        {
            if (floorChunk == null)
            {
                ErrorManager.SpurtError("생성도 안됐는데 청크를 바꾸려함,");
            }
            if (this.whichTurn == whichTurn)
            {
                Debug.Log("똑같은 턴 반향임");
                return;
            }

            for (int i = 0; i < objs.Count; i++)
            {
                if (objs[i] != null)
                {
                    MapAndObjPool.GetInstance().TurnInPoolObj(objs[i]);
                }
            }
            objs.Clear();//참조만 날라감. 괜찮음.

            soa.spawnObjType[0] = E_SPAWN_OBJ_TYPE.NOTHING;
            soa.spawnObjType[1] = E_SPAWN_OBJ_TYPE.NOTHING;
            soa.spawnObjType[2] = E_SPAWN_OBJ_TYPE.NOTHING;

            this.whichTurn = whichTurn;
            //위치턴 따라서 플로어 청크 분기해오기.
            bornPos.z = floorChunk.transform.position.z;
            MapAndObjPool.GetInstance().TurnInPoolObj(floorChunk);

            switch (whichTurn)
            {
            case E_WhichTurn.LEFT:
                //왼쪽 으로 청크 풀링 해오기.
                floorChunk =
                    MapAndObjPool.GetInstance().GetTurnLeftChunksInPool();
                break;

            case E_WhichTurn.RIGHT:
                //오른쪽으로 청크 풀링
                floorChunk =
                    MapAndObjPool.GetInstance().GetTurnRightChunksInPool();
                break;

            case E_WhichTurn.NOT_TURN:
                floorChunk
                    = MapAndObjPool.GetInstance().GetChunkInPool();
                break;

            default:
                ErrorManager.SpurtError("위치턴이 아무것도 아닌 심각한 오류.");
                break;
            }
            floorChunk.transform.position = bornPos;
            floorChunk.SetActive(true);
        }
예제 #7
0
        public void BossPatternFireBallShoot(Vector3 pos)
        {
            GameObject temp =
                MapAndObjPool.GetInstance().GetBossObsFireBallInPool();

            if (temp == null)
            {
                return;
            }
            temp.transform.position = pos;
            temp.SetActive(true);
            bossAttackObj.Add(temp);
        }
예제 #8
0
 public void ReadyForGrave()
 {
     if (floorChunk != null)
     {
         MapAndObjPool.GetInstance().TurnInPoolObj(floorChunk);
     }
     for (int i = 0; i < objs.Count; i++)
     {
         if (objs[i] != null)
         {
             MapAndObjPool.GetInstance().TurnInPoolObj(objs[i]);
         }
     }
     objs.Clear();//참조만 날라감. 괜찮음.
 }
예제 #9
0
 public void Reset()
 {
     position = -1;
     if (chunk != null)
     {
         MapAndObjPool.GetInstance().TurnInPoolObj(chunk);
         chunk = null;
     }
     for (int i = 0; i < objs.Count; i++)
     {
         if (objs[i] != null && objs[i].activeSelf == true)
         {
             MapAndObjPool.GetInstance().TurnInPoolObj(objs[i]);
         }
     }
     objs.Clear();//참조만 날라감. 괜찮음.
 }
예제 #10
0
        public void BossPatternObjGen(E_BOSSPATTERN pattern, float disFromPlayer, E_SPAWNLINE line)
        {
            if ((false == (pattern == E_BOSSPATTERN.BREATH || pattern == E_BOSSPATTERN.METEOR)))
            {
                return;
            }

            pos.x = GetLineXPos(line);
            pos.y = 0f;
            pos.z = disFromPlayer;
            GameObject obj;

            switch (pattern)
            {
            case E_BOSSPATTERN.BREATH:

                //브레스 프리팹 풀링해오기.
                obj = MapAndObjPool.GetInstance().GetBossObsBreathInPool();
                if (obj == null)
                {
                    return;
                }
                obj.transform.SetPositionAndRotation(pos, Quaternion.Euler(0, 180, 0));
                obj.SetActive(true);
                bossAttackObj.Add(obj);
                break;

            case E_BOSSPATTERN.METEOR:

                //메테오 프리팹 풀링해오기
                obj = MapAndObjPool.GetInstance().GetBossObsMeteorInPool();
                if (obj == null)
                {
                    return;
                }
                obj.transform.SetPositionAndRotation(pos, Quaternion.Euler(0, 180, 0));
                obj.SetActive(true);
                bossAttackObj.Add(obj);

                break;
            }
        }
예제 #11
0
        void MapObjPoolingGeneration()
        {
            MapAndObjPool.GetInstance().ChunkPoolInit(10);

            MapAndObjPool.GetInstance().TurnLeftChunksPoolInit(3);
            MapAndObjPool.GetInstance().TurnRightChunksPoolInit(3);

            MapAndObjPool.GetInstance().obsBallPoolInit(30);
            MapAndObjPool.GetInstance().obsHuddlePoolInit(30);
            MapAndObjPool.GetInstance().obsUpperHuddle_1_PoolInit(30);
            MapAndObjPool.GetInstance().obsUpperHuddle_2_PoolInit(30);
            MapAndObjPool.GetInstance().obsUpperHuddle_3_PoolInit(30);
            MapAndObjPool.GetInstance().obsFirePoolInit(30);

            MapAndObjPool.GetInstance().itemHPPlusPoolInit(30);
            MapAndObjPool.GetInstance().itemInvinciblePoolInit(30);
            MapAndObjPool.GetInstance().itemShieldPoolInit(30);
            MapAndObjPool.GetInstance().itemCoinPoolInit(30);
            MapAndObjPool.GetInstance().itemMagnetPoolInit(30);
            MapAndObjPool.GetInstance().itemCoin_Parabola_PoolInit(30);
            MapAndObjPool.GetInstance().itemCoin_StraightLine_PoolInit(30);
        }
예제 #12
0
        void ChunkCreateAndDel()
        {
            foreach (float pos in crtAndDelPosLists[(int)E_CHUNK_CREATE_DEL.DEL])   //삭제할 청크
            {
                if (posList.Contains(pos))
                {
                    DataOfMapObjMgr.GetInstance().TurnInChunkObjSTPool(pos);
                }
                else
                {
                    Debug.Log("청크 삭제 중 오류 001");
                }
            }

            foreach (float pos in crtAndDelPosLists[(int)E_CHUNK_CREATE_DEL.CREATE])    //생성할 청크
            {
                Vector3    createPos = new Vector3(0, 0, pos);
                GameObject crtChunk  = MapAndObjPool.GetInstance().GetChunkInPool();
                ChunkObjST temp;
                if (crtChunk != null)
                {
                    crtChunk.transform.SetPositionAndRotation(createPos, Quaternion.identity);
                    crtChunk.SetActive(true);
                    temp = DataOfMapObjMgr.GetInstance().GetEmptyChunkObjSTFromPool(crtChunk, pos);
                    if (temp != null)
                    {
                        rtChunkObjSTList.Add(temp);
                    }
                    else
                    {
                        ErrorManager.SpurtError("청크자료구조 받아오던중 에러");
                    }
                }
                else
                {
                    Debug.Log("청크 풀 부족");
                }
            }
        }
예제 #13
0
        public void showThisToEditor(int standardPos, float chunkMargin)
        {
            bornPos.z = (pos - standardPos) * chunkMargin;  //이렇게 하면 기준 점기준으로 현재 pos가 가리키는 위치를 얻을 수 있어.

            //Debug.Log(bornPos.ToString() + "에 생성!!");

            switch (whichTurn)
            {
            case E_WhichTurn.LEFT:
                //왼쪽 으로 청크 풀링 해오기.
                floorChunk =
                    MapAndObjPool.GetInstance().GetTurnLeftChunksInPool();
                break;

            case E_WhichTurn.RIGHT:
                //오른쪽으로 청크 풀링
                floorChunk =
                    MapAndObjPool.GetInstance().GetTurnRightChunksInPool();
                break;

            case E_WhichTurn.NOT_TURN:
                floorChunk
                    = MapAndObjPool.GetInstance().GetChunkInPool();
                break;

            default: ErrorManager.SpurtError("위치턴이 아무것도 아닌 심각한 오류.");
                break;
            }
            floorChunk.transform.position = bornPos;
            floorChunk.SetActive(true);

            if (whichTurn == E_WhichTurn.NOT_TURN)
            {
                spg = floorChunk.transform.GetChild(3);
                FixedObjGenerator.FixedObjGen(spg, soa.spawnObjType, ref objs);
            }
            isNowShowed = true;
        }
예제 #14
0
        private void Start()
        {
            whatStage = StageManager.stageNum;

            MapAndObjPool.GetInstance().ChunkPoolInit(10);

            MapAndObjPool.GetInstance().obsBallPoolInit(10);
            MapAndObjPool.GetInstance().obsHuddlePoolInit(10);
            MapAndObjPool.GetInstance().obsUpperHuddle_1_PoolInit(10);
            MapAndObjPool.GetInstance().obsUpperHuddle_2_PoolInit(10);
            MapAndObjPool.GetInstance().obsUpperHuddle_3_PoolInit(10);
            MapAndObjPool.GetInstance().obsFirePoolInit(10);

            MapAndObjPool.GetInstance().itemHPPlusPoolInit(10);
            MapAndObjPool.GetInstance().itemInvinciblePoolInit(10);
            MapAndObjPool.GetInstance().itemShieldPoolInit(10);
            MapAndObjPool.GetInstance().itemCoinPoolInit(10);
            MapAndObjPool.GetInstance().itemMagnetPoolInit(10);
            MapAndObjPool.GetInstance().itemCoin_Parabola_PoolInit(10);
            MapAndObjPool.GetInstance().itemCoin_StraightLine_PoolInit(10);

            StartCoroutine(checkPos()); //부하를 줄이기 위해 0.2초 단위로 체크
        }
예제 #15
0
        public void DisappearFromEditor()
        {
            if (floorChunk == null)
            {
                ErrorManager.SpurtError("생성도 안됐는데 삭제를 불러와짐");
            }

            MapAndObjPool.GetInstance().TurnInPoolObj(floorChunk);

            floorChunk = null;
            spg        = null;

            for (int i = 0; i < objs.Count; i++)
            {
                if (objs[i] != null)
                {
                    MapAndObjPool.GetInstance().TurnInPoolObj(objs[i]);
                }
            }
            objs.Clear();

            isNowShowed = false;
        }
예제 #16
0
        public static GameObject ObjSpawnFactory(E_SPAWN_OBJ_TYPE typeOfObj, Transform spawnPoint)
        {
            GameObject spawned;

            switch (typeOfObj)
            {
            case E_SPAWN_OBJ_TYPE.BALL:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetObsBallInPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.COIN:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetItemCoinInPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.COIN_PARABOLA:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetItemCoin_Parabola_InPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.COIN_STRAIGHT:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetItemCoin_StraightLine_InPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.FIRE:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetObsFireInPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.HPPLUS:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetItemHPPlusInPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.HUDDLE:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetObsHuddleInPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.INVINCIBLE:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetItemInvincibleInPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.MAGNET:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetItemMagnetInPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.NOTHING:
                spawned =
                    null;
                break;

            case E_SPAWN_OBJ_TYPE.SHIELD:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetItemShieldInPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.UPPER_HUDDLE_1:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetObsUpperHuddle_1_InPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.UPPER_HUDDLE_2:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetObsUpperHuddle_2_InPool(), spawnPoint);
                break;

            case E_SPAWN_OBJ_TYPE.UPPER_HUDDLE_3:
                spawned =
                    GenByPool(MapAndObjPool.GetInstance().GetObsUpperHuddle_3_InPool(), spawnPoint);
                break;

            default:
                ErrorManager.SpurtError("오브젝트 팩토리에서 에러");
                spawned = null;
                break;
            }
            return(spawned);
        }