예제 #1
0
파일: Road.cs 프로젝트: jjcat/Air_Rush
    //         public  void CreateRoad(string patternFile)
    //         {
    //             _road = new string[100 * 10];
    //             int length = 0;
    //             Patterns pat = new Patterns();
    //             pat.ReadPatternsFile(patternFile);
    //             string bottomSlot = pat.GetSlotRandom();
    //             for (int i = 0; i < 100; i++)
    //             {
    //                 string[] pattern = pat.GetPatternRandomWithBottomSlot(bottomSlot);
    //                 for (int j = 0; j < 10; ++j)
    //                 {
    //                     _road[length++] = pattern[j];
    //                 }
    //                 bottomSlot = _road[length-1];
    //             }
    //         }
    public string[] CreateRoad()
    {
        string bottomSlot = "@@@@OO";
            int length = 0;
            for (int i = 0; i < _levelLength.Count(); ++i)
            {
                Patterns pat = new Patterns();
                pat.ReadPatternsFile(Application.dataPath + "/" + _patternFileName[i]);
                for (int j = 0; j < _levelLength[i]; j++)
                {
                    string[] pattern = pat.GetPatternRandomWithBottomSlot(bottomSlot);
                    for (int k = 0; k < 10; k++)
                    {
                        _road[length++] = pattern[k];
                    }
                    bottomSlot = _road[length - 1];

                }
            }
            return _road;
    }