Exemplo n.º 1
0
        public override void Load()
        {
            TilePaths paths = InitTilePaths();

            PFStartTrack    = Resources.Load <CTrackTile>(paths.PathStartTrack);
            PFVerticalTrack = Resources.Load <CTrackTile>(paths.PathVerticalTrack);
            PFEndTrack      = Resources.Load <CTrackTile>(paths.PathEndTrack);

            PFTrackA = Resources.Load <CTrackTile>(paths.PathTrackA);
            PFTrackB = Resources.Load <CTrackTile>(paths.PathTrackB);
            PFTrackC = Resources.Load <CTrackTile>(paths.PathTrackC);
            PFTrackD = Resources.Load <CTrackTile>(paths.PathTrackD);
            PFTrackE = Resources.Load <CTrackTile>(paths.PathTrackE);
            PFTrackF = Resources.Load <CTrackTile>(paths.PathTrackF);
            PFTrackG = Resources.Load <CTrackTile>(paths.PathTrackG);



            TrackKind = new Dictionary <CTrackCreater.TRACKKIND, CTrackTile>();

            TrackKind.Add(CTrackCreater.TRACKKIND.START, PFStartTrack);
            TrackKind.Add(CTrackCreater.TRACKKIND.VERTICAL, PFVerticalTrack);
            TrackKind.Add(CTrackCreater.TRACKKIND.A, PFTrackA);
            TrackKind.Add(CTrackCreater.TRACKKIND.B, PFTrackB);
            TrackKind.Add(CTrackCreater.TRACKKIND.C, PFTrackC);
            TrackKind.Add(CTrackCreater.TRACKKIND.D, PFTrackD);
            TrackKind.Add(CTrackCreater.TRACKKIND.E, PFTrackE);
            TrackKind.Add(CTrackCreater.TRACKKIND.F, PFTrackF);
            TrackKind.Add(CTrackCreater.TRACKKIND.G, PFTrackG);
            TrackKind.Add(CTrackCreater.TRACKKIND.END, PFEndTrack);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 트랙창고리스트에서 원하는 종류의 트랙타일을 받아오는 메소드 IF 창고안에 비활성화 된 트랙타일이 없을시 생성하여 가져옵니다.
        /// </summary>
        /// <param name="tTrackKind">원하는 트랙의 종류</param>
        /// <returns>원하는 트랙타일을 반환</returns>
        public CTrackTile GetTrackTile(CTrackCreater.TRACKKIND tTrackKind)
        {
            CTrackTile tTile = null;

            if (TrackStorage.ContainsKey(tTrackKind))
            {
                for (int i = 0; i < TrackStorage[tTrackKind].Count; i++)
                {
                    if (TrackStorage[tTrackKind][i].gameObject.activeSelf == false)
                    {
                        tTile = TrackStorage[tTrackKind][i];
                        return(tTile);
                    }
                }

                tTile = GameObject.Instantiate(GetPrefab(tTrackKind), Vector3.zero, Quaternion.identity);
                tTile.gameObject.SetActive(false);
                tTile.transform.SetParent(mTrackParent);
                tTile.SetTrackCreater(mTrackCreater);

                TrackStorage[tTrackKind].Add(tTile);
                return(tTile);
            }

            return(null);
        }
Exemplo n.º 3
0
        public void InitTrackStorage(Transform tParent, CTrackCreater tTrackCreater)
        {
            mTrackParent  = tParent;
            mTrackCreater = tTrackCreater;

            TrackStorage = new Dictionary <CTrackCreater.TRACKKIND, List <CTrackTile> >();
            var tTrackKinds = System.Enum.GetValues(typeof(CTrackCreater.TRACKKIND)).GetEnumerator();

            while (tTrackKinds.MoveNext())
            {
                CTrackCreater.TRACKKIND tKind = (CTrackCreater.TRACKKIND)tTrackKinds.Current;
                int tCreateCount = 0;

                if (tKind == CTrackCreater.TRACKKIND.START || tKind == CTrackCreater.TRACKKIND.END)
                {
                    tCreateCount = 1;
                }
                else
                {
                    tCreateCount = 5;
                }

                for (int i = 0; i < tCreateCount; i++)
                {
                    if (TrackStorage.ContainsKey(tKind) == false)
                    {
                        TrackStorage.Add(tKind, new List <CTrackTile>());
                    }
                    if (GetPrefab(tKind) == null)
                    {
                        Debug.Log("Prefab is Null");
                    }
                    CTrackTile tTile = GameObject.Instantiate(GetPrefab(tKind), Vector3.zero, Quaternion.identity);
                    tTile.gameObject.SetActive(false);
                    tTile.transform.SetParent(tParent);
                    tTile.SetTrackCreater(mTrackCreater);



                    TrackStorage[tKind].Add(tTile);
                }
            }
        }
Exemplo n.º 4
0
    /// <summary>
    /// 플레이어 위치값에 따른 트랙타일을 화면에서 꺼주는 메소드
    /// </summary>
    /// <param name="tPlayerPositionIndex">플레이어의 위치값</param>
    public void UpdateTrack(int tPlayerPositionIndex)
    {
        for (int ti = 0; ti < mSight; ti++)
        {
            if (tPlayerPositionIndex + ti < TrackList.Count)
            {
                TRACKKIND tKind = TrackList[tPlayerPositionIndex + ti];

                if (ActiveTrackTileIndex.Contains(tPlayerPositionIndex + ti) == false)
                {
                    CTrackTile tTile = DistinguishTrack(tKind, tPlayerPositionIndex + ti);

                    ActiveTrackTileIndex.Enqueue(tPlayerPositionIndex + ti);


                    if (ActiveTrackTile.Count < mSight)
                    {
                        ActiveTrackTile.Enqueue(tTile);
                    }
                    else
                    {
                        ActiveTrackTile.Dequeue().Hide();
                        ActiveTrackTile.Enqueue(tTile);
                    }
                }
            }
            else
            {
                break;
            }
        }
        if (tPlayerPositionIndex == TrackList.Count - 1)
        {
            Debug.Log("여긴옴?");
            AddStageNumber();
            ReSetData();
        }
    }
Exemplo n.º 5
0
    public void LoadAboutPrefabs()
    {
        PFStartTrack = Resources.Load <CTrackTile>("Prefabs/Thema0/PFStartTrack");

        PFVerticalTrack   = Resources.Load <CTrackTile>("Prefabs/Thema0/PFVerticalTrack");
        PFHorizontalTrack = Resources.Load <CTrackTile>("Prefabs/Thema0/PFHorizontalTrack");

        PFUpLeftTrack  = Resources.Load <CTrackTile>("Prefabs/Thema0/PFUpLeftTrack");
        PFLeftUpTrack  = Resources.Load <CTrackTile>("Prefabs/Thema0/PFLeftUpTrack");
        PFUpRightTrack = Resources.Load <CTrackTile>("Prefabs/Thema0/PFUpRightTrack");
        PFRightUpTrack = Resources.Load <CTrackTile>("Prefabs/Thema0/PFRightUpTrack");

        PFEndTrack = Resources.Load <CTrackTile>("Prefabs/Thema0/PFEndTrack");



        TrackKind = new Dictionary <CTrackCreater.TRACKKIND, CTrackTile>();

        TrackKind.Add(CTrackCreater.TRACKKIND.START, PFStartTrack);

        TrackKind.Add(CTrackCreater.TRACKKIND.VERTICAL, PFVerticalTrack);

        TrackKind.Add(CTrackCreater.TRACKKIND.END, PFEndTrack);
    }