public void CreateHan()
    {
        MMainTrack = Resources.Load <Material>("Material/MMainTrack");
        MLine      = Resources.Load <Material>("Material/Mline");
        MOutSide   = Resources.Load <Material>("Material/MOutSide");
        MWall      = Resources.Load <Material>("Material/MWall");

        PFTrack = Resources.Load <CTrack>("Prefabs/PFTrack");

        PFStartTrack = Resources.Load <CTrackParts>("Prefabs/PFStartTrack");

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

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

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

        mTrackKind = new Dictionary <CTrackFactory.TRACKKIND, CTrackParts>();

        mTrackKind.Add(CTrackFactory.TRACKKIND.START, PFStartTrack);

        mTrackKind.Add(CTrackFactory.TRACKKIND.VERTICAL, PFVerticalTrack);
        mTrackKind.Add(CTrackFactory.TRACKKIND.HORIZONTAL, PFHorizontalTrack);

        mTrackKind.Add(CTrackFactory.TRACKKIND.UPLEFT, PFUpLeftTrack);
        mTrackKind.Add(CTrackFactory.TRACKKIND.LEFTUP, PFLeftUpTrack);
        mTrackKind.Add(CTrackFactory.TRACKKIND.UPRIGHT, PFUpRightTrack);
        mTrackKind.Add(CTrackFactory.TRACKKIND.RIGHTUP, PFRightUpTrack);
        mTrackKind.Add(CTrackFactory.TRACKKIND.END, PFEndTrack);
    }
Exemple #2
0
    /// <summary>
    /// 커브트랙 다음에 생성되는 트랙이 최소 3개이상 직선트랙이 나오게 생성하는 메소드
    /// </summary>
    /// <param name="tTrackParts">얘는 트랙파츠ㅇㅇ</param>
    public void CreateStraightTrack(CTrackParts tTrackParts)
    {
        tTrackParts = null;

        for (int ti = 0; ti < STRAIGHT_COUNT; ti++)
        {
            if (TOTAL_TRACK > mTrackCount)
            {
                if (TRACKKIND.LEFTUP == GetCurrentTrack() || TRACKKIND.RIGHTUP == GetCurrentTrack())
                {
                    tTrackParts = GameObject.Instantiate <CTrackParts>(CHanMapDataMgr.GetInst().GetPrefab(TRACKKIND.VERTICAL), mNextPos, Quaternion.identity);
                }
                else if (TRACKKIND.UPLEFT == GetCurrentTrack() || TRACKKIND.UPRIGHT == GetCurrentTrack())
                {
                    tTrackParts = GameObject.Instantiate <CTrackParts>(CHanMapDataMgr.GetInst().GetPrefab(TRACKKIND.HORIZONTAL), mNextPos, Quaternion.identity);
                }
                else
                {
                    return;
                }
                mBeforePos = tTrackParts.transform.position;
                AddTrackCount();
                mNextPos = mBeforePos + mCurrentDirection * TRACK_SIZE;
            }
        }
    }
Exemple #3
0
    /// <summary>
    /// 시작트랙를 먼저 설치를 한다.
    /// </summary>
    public void CreateStartTrack()
    {
        CTrackParts tStartTrack = null;

        SetCurrentTrack(TRACKKIND.START);
        tStartTrack       = GameObject.Instantiate <CTrackParts>(CHanMapDataMgr.GetInst().GetPrefab(this.GetCurrentTrack()), Vector3.zero, Quaternion.identity);
        mBeforePos        = tStartTrack.transform.position;
        mNextPos          = Vector3.zero;
        mCurrentDirection = Vector3.forward;
        mNextPos          = mCurrentDirection * TRACK_SIZE;
    }
Exemple #4
0
 /// <summary>
 /// 마지막트랙 생성 메소드
 /// </summary>
 /// <param name="tTrackParts">얘는 트랙파츠라니깐?</param>
 public void CreateEndTrack(CTrackParts tTrackParts)
 {
     if (TOTAL_TRACK == mTrackCount)
     {
         tTrackParts = GameObject.Instantiate <CTrackParts>(CHanMapDataMgr.GetInst().GetPrefab(TRACKKIND.END), mNextPos, Quaternion.identity);
         if (mCurrentDirection == Vector3.right)
         {
             tTrackParts.transform.Rotate(new Vector3(0.0f, 90.0f, 0.0f));
         }
         else if (mCurrentDirection == Vector3.left)
         {
             tTrackParts.transform.Rotate(new Vector3(0.0f, -90.0f, 0.0f));
         }
     }
 }
Exemple #5
0
    /// <summary>
    /// 트랙을 직접적으로 조립하는 메소드
    /// </summary>
    public void DistinguishTrack()
    {
        var         tTrackList     = mNextTrackKind[mCurrentTrack];
        var         tNextTrackKind = tTrackList[Random.Range(0, tTrackList.Count)];
        CTrackParts tTrackParts    = null;

        if (tNextTrackKind != TRACKKIND.TURN)
        {
            tTrackParts = GameObject.Instantiate <CTrackParts>(CHanMapDataMgr.GetInst().GetPrefab(tNextTrackKind), mNextPos, Quaternion.identity);
            if (tNextTrackKind != TRACKKIND.HORIZONTAL)
            {
                mCurrentDirection = tTrackParts.mDirection;
            }
            SetCurrentTrack(tNextTrackKind);
        }
        else
        {
            if (Vector3.right == mCurrentDirection)
            {
                tTrackParts = GameObject.Instantiate <CTrackParts>(CHanMapDataMgr.GetInst().GetPrefab(TRACKKIND.RIGHTUP), mNextPos, Quaternion.identity);
                SetCurrentTrack(TRACKKIND.RIGHTUP);
            }
            else
            {
                tTrackParts = GameObject.Instantiate <CTrackParts>(CHanMapDataMgr.GetInst().GetPrefab(TRACKKIND.LEFTUP), mNextPos, Quaternion.identity);
                SetCurrentTrack(TRACKKIND.LEFTUP);
            }

            mCurrentDirection = tTrackParts.mDirection;
        }
        AddTrackCount();
        mBeforePos = tTrackParts.transform.position;
        mNextPos   = mBeforePos + mCurrentDirection * TRACK_SIZE;
        CreateStraightTrack(tTrackParts);
        CreateEndTrack(tTrackParts);
    }