Example #1
0
        public void UpdateTrackTile(int pivot)
        {
            if (mCurrentPivot >= pivot)
            {
                return;
            }
            mCurrentPivot = pivot;

            int start = Mathf.Clamp(pivot - 1, 0, mInstTrackIndex);
            int end   = Mathf.Clamp(start + mSight, 0, mInstTrackIndex + 1);

            for (int i = start; i < end; i++)
            {
                if (mInstTileList.ContainsKey(i) && mShowTileQueue.Contains(mInstTileList[i]) == false)
                {
                    mInstTileList[i].Show();

                    if (mInstTileList[i].GetTrackType() == TrackType.END)
                    {
                        if (mThemeStack.Count > 0)
                        {
                            LeftThemeIndex = mThemeStack.Pop();
                        }
                        else
                        {
                            LeftThemeIndex = mCurrentPFTrackIndex;
                        }

                        if (mThemeStack.Count > 0)
                        {
                            RightThemeIndex = mThemeStack.Pop();
                        }
                        else
                        {
                            RightThemeIndex = mCurrentPFTrackIndex;
                        }


                        mOnShowEndTrack.SafeInvoke(LeftThemeIndex, RightThemeIndex);
                        mIsNextTheme = true;
                    }

                    mShowTileQueue.Enqueue(mInstTileList[i]);
                    if (mShowTileQueue.Count > mSight)
                    {
                        mShowTileQueue.Dequeue().Hide();
                    }
                }
                else // 이미 보여지고 있음
                {
                }
            }
        }
Example #2
0
        public void SelectNextTheme(int select)
        {
            if (mIsNextTheme)
            {
                if (select == -1)
                {
                    mCurrentPFTrackIndex = LeftThemeIndex;
                    if (mStageIndex < 1)
                    {
                        mThemeStack.Push(RightThemeIndex);
                    }
                }
                else if (select == 1)
                {
                    mCurrentPFTrackIndex = RightThemeIndex;
                    if (mStageIndex < 1)
                    {
                        mThemeStack.Push(LeftThemeIndex);
                    }
                }
                mOnSelectTheme.SafeInvoke(select);

                mIsNextTheme = false;
                int start = (70 - 2) * mStageIndex;
                int end   = (70 - 2) * (mStageIndex + 1);

                foreach (var tile in mInstTileList)
                {
                    if (tile.Value.GetTrackType() == TrackType.END)
                    {
                        end = tile.Value.Index - 1;
                        break;
                    }
                }

                Debug.Log(end);
                if (mStageIndex > 0)
                {
                    end += 4 + (mStageIndex);
                }
                for (int i = start; i < end; i++)
                {
                    if (mInstTileList.ContainsKey(i))
                    {
                        mInstTileList[i].TileDestroy();
                        mInstTileList.Remove(i);
                    }
                }
                mStageIndex++;
                CreateTrackData();
                PositionTracks();
            }
        }
Example #3
0
        public void PositionTracks()
        {
            foreach (var tTrackType in mTrackPlaceData)
            {
                if (CurrentPFTracks.ContainsKey(tTrackType))
                {
                    CTrack tTrack = GameObject.Instantiate <CTrack>(CurrentPFTracks[tTrackType], mTrackInstancePosition, Quaternion.identity);
                    tTrack.transform.SetParent(mParent);
                    mTrackInstancePosition += Vector3.forward * CurrentPFTracks[tTrackType].TrackLength;


                    tTrack.DisableTiles();
                    tTrack.gameObject.name = string.Format("[{0}] {1}", mInstTrackIndex, tTrack.gameObject.name);

                    foreach (var tile in tTrack.InstTileList)
                    {
                        mInstTileList.Add(mInstTrackIndex, tile);
                        tile.Init(this, mInstTrackIndex, tTrackType);
                        mInstTrackIndex++;
                    }
                }
            }
            mOnChangeStage.SafeInvoke(mStageIndex + 1, mCurrentPFTrackIndex);
        }
Example #4
0
 public void Handle(T arg)
 {
     Debug.LogFormat("Received {0}", arg.GetType());
     OnDel.SafeInvoke(this);
 }