コード例 #1
0
ファイル: MonsterSpawner.cs プロジェクト: zzhXD/ATD
    IEnumerator CreateMonster()
    {
        if (waveQueue.Count <= 0)
        {
            yield break;
        }

        WaveInformation waveInformation = waveQueue.Dequeue();

        //每一波生成前的等待时间
        yield return(new WaitForSeconds(waveInformation.time));

        //每一个怪物列表
        foreach (var monsterList in waveInformation.monsterLists)
        {
            for (int j = 0; j < monsterList.count; ++j)
            {
                //生成怪物
                var monster = Instantiate(monsterPrefabs[monsterList.monsterID - 1], spawnPoint.position, Quaternion.identity, Monsters);
                //设置路径
                monster.GetComponent <BehaviorTree>().SetVariableValue("Road", wayPointManager.GetRoad(monsterList.wayID - 1));
                //生成间隔
                float rate = monsterList.rate;
                yield return(new WaitForSeconds(rate));
            }
        }

        alreadySpawnOneWave = true;
    }
コード例 #2
0
	// Use this for initialization
	/*void Start () {
		
	}*/
	
	// Update is called once per frame
	/*void Update () {
		
	}*/

	public void ReadFile (string filename)
	{
		TextAsset textAsset = Resources.Load (filename) as TextAsset;
		StringReader reader = new StringReader (textAsset.text);
		waveInfo = new List<WaveInformation[]> ();
		string s;
		int monsterNum;
		WaveInformation[] wave;
		while (true) {
			s = reader.ReadLine ();
			if (s == null)
				break;
			monsterNum = int.Parse (s);
			wave = new WaveInformation[monsterNum];
			for (int i = 0; i < monsterNum; i++) {
				s = reader.ReadLine ();
				string[] sp = s.Split (new char[] { ' ' });
				wave [i] = new WaveInformation();
				wave [i].bornTime = float.Parse (sp [0]);
				wave [i].monster = monster [int.Parse (sp [1])];
				wave [i].waveItemType = int.Parse (sp [1]);
				wave [i].bornPos = new IntVector2 (int.Parse (sp [2]), int.Parse (sp [3]));
			}
			waveInfo.Add (wave);
		}
		nowWave = 0;
	}
コード例 #3
0
	void Start () {
		//Time.timeScale = 1;
		Map.Initialize ();
		timer = 0;
		waveTime = 0;

		ApplicationModel.currentEnemyNum = 0;

		myAudio = GetComponent<AudioSource>();
		PlaySound(GAME_MUSIC);
	
		level = ApplicationModel.GetCurrentLevel();	
		
		wave = GetComponent<WaveController>();
		wave.ReadFile(level.ID);
		next = wave.Next ();
		initWarning ();
		player = playerObject.GetComponent<Player>();
		
		
		level.Start();
		Debug.Log( "This level has been started "+level.GetTimesStarted()+" times.");
		Debug.Log( "This level has been played "+level.GetTimesPlayed()+" times.");

		fadeEffect = fader.GetComponent<FadeEffect> ();
		fadeEffect.FadeIn ();
		gameStartPlayed = false;

	}
コード例 #4
0
ファイル: IQMania.cs プロジェクト: adeyblue/IQTools
        static void DecompWavePuzzles(WaveInformation wi, byte[] puzzles, List <int> puzzPos)
        {
            int width      = wi.puzWidth;
            int height     = wi.puzHeight;
            int totalCubes = height * width;

            byte[]        buffer      = new byte[32];
            byte[]        cleanBuffer = new byte[32];
            int           lastPuzzle  = wi.startingPuzzlePosOffset + wi.numPuzzles;
            List <int>    trnList     = wi.trns = new List <int>(wi.numPuzzles);
            List <byte[]> decompList  = wi.decompPuzzles = new List <byte[]>(wi.numPuzzles);

            for (int i = wi.startingPuzzlePosOffset; i < lastPuzzle; ++i)
            {
                byte[] decompPuzzle = new byte[totalCubes];
                Buffer.BlockCopy(cleanBuffer, 0, buffer, 0, cleanBuffer.Length);
                int puzzOff  = puzzPos[i];
                int numBytes = puzzles[puzzOff] - 1;
                Buffer.BlockCopy(puzzles, puzzOff + 1, buffer, 0, numBytes);
                int trn        = DecompressPuzzle(buffer, totalCubes) + 1;
                int revPuzIter = totalCubes - 1;
                while (revPuzIter >= 0)
                {
                    byte rem = DecompressPuzzle(buffer, 3);
                    decompPuzzle[revPuzIter] = rem;
                    --revPuzIter;
                }
                decompList.Add(decompPuzzle);
                trnList.Add(trn);
            }
        }
コード例 #5
0
        static KurushRNG.Program.PuzzleStats WritePuzzles(WaveInformation wi, out KurushRNG.Program.TRNStats trnStats)
        {
            int width = wi.puzWidth, height = wi.puzHeight;

            int[] trns       = wi.trns.ToArray();
            int   numPuzzles = wi.numPuzzles;

            KurushRNG.Program.PuzzleStats puzStats = ComputePuzzleStats(wi.decompPuzzles, width, height);
            trnStats = KurushRNG.Program.ComputeTRNStats(trns);
            return(puzStats);
        }
コード例 #6
0
ファイル: MonsterSpawner.cs プロジェクト: zzhXD/ATD
    //获取json文件,传入json文件路径
    private void GetJsonToLevelData(string path)
    {
        //如果文件不存在,则跳出该方法
        if (File.Exists(path) == false)
        {
            Logger.Log(path + "  文件不存在", LogType.Data);
            return;
        }

        //获取文件数据流读入
        StreamReader streamReader = new StreamReader(path);

        //获取json文件的string格式,可优化
        string jsonToString = streamReader.ReadToEnd();

        //获得json中的数据
        Dictionary <string, JsonData> levelData = JsonMapper.ToObject <Dictionary <string, JsonData> >(jsonToString);

        if (levelData == null)
        {
            Logger.Log("没有获取到 关卡json 文件", LogType.Data);
        }
        else
        {
            Logger.Log("已获取到关卡json数据", LogType.Data);
            //获取关卡队列
            var missions = levelData["mission"];
            for (int i = 0; i < missions.Count; ++i)
            {
                //获取某个关卡的怪物列表
                JsonData           monsterLists = missions[i]["monsterList"];
                List <MonsterList> onelist      = new List <MonsterList>();
                for (int j = 0; j < monsterLists.Count; ++j)
                {
                    MonsterList m = new MonsterList();
                    m.monsterID = (int)monsterLists[j]["monsterID"];
                    m.rate      = (float)monsterLists[j]["rate"];
                    m.wayID     = (int)monsterLists[j]["wayID"];
                    m.count     = (int)monsterLists[j]["count"];

                    onelist.Add(m);
                }
                //生成某个关卡的数据
                WaveInformation waveInformation = new WaveInformation();
                waveInformation.time         = (int)missions[i]["time"];
                waveInformation.monsterLists = onelist;

                waveQueue.Enqueue(waveInformation);
            }

            Logger.Log("成功获取关卡队列:" + waveQueue.Count, LogType.Monster);
        }
    }
コード例 #7
0
 public WaveInformation(WaveInformation inf)
 {
     waveIndex               = inf.waveIndex;
     puzzlesPerWave          = inf.puzzlesPerWave;
     puzWidth                = inf.puzWidth;
     puzHeight               = inf.puzHeight;
     startingPuzzlePosOffset = inf.startingPuzzlePosOffset;
     numPuzzles              = inf.numPuzzles;
     trns          = null;
     decompPuzzles = null;
     dupPuzzles    = new Dictionary <ulong, DuplicatePuzzles>();
 }
コード例 #8
0
        static uint CalculateUniquePuzzles(WaveInformation wi)
        {
            List <ulong> keys  = new List <ulong>(wi.dupPuzzles.Keys);
            uint         count = 0;

            while (keys.Count > 0)
            {
                ulong            firstKey = keys[0];
                DuplicatePuzzles dup      = wi.dupPuzzles[firstKey];
                keys.Remove(dup.oppositeHash);
                keys.RemoveAt(0);
                ++count;
            }
            return(count);
        }
コード例 #9
0
        static public void DecompWavePuzzles(WaveInformation wi, byte[] puzzles, List <int> puzzPos)
        {
            int width      = wi.puzWidth;
            int height     = wi.puzHeight;
            int totalCubes = height * width;

            byte[]        buffer       = new byte[32];
            byte[]        cleanBuffer  = new byte[32];
            int           lastPuzzle   = wi.startingPuzzlePosOffset + wi.numPuzzles;
            List <int>    trnList      = wi.trns = new List <int>(wi.numPuzzles);
            List <byte[]> decompList   = wi.decompPuzzles = new List <byte[]>(wi.numPuzzles);
            uint          puzzleNumber = 0;

            for (int i = wi.startingPuzzlePosOffset; i < lastPuzzle; ++i, ++puzzleNumber)
            {
                byte[] decompPuzzle = new byte[totalCubes];
                Buffer.BlockCopy(cleanBuffer, 0, buffer, 0, cleanBuffer.Length);
                int puzzOff  = puzzPos[i];
                int numBytes = puzzles[puzzOff] - 1;
                Buffer.BlockCopy(puzzles, puzzOff + 1, buffer, 0, numBytes);
                int trn        = DecompressPuzzle(buffer, totalCubes) + 1;
                int revPuzIter = totalCubes - 1;
                while (revPuzIter >= 0)
                {
                    byte rem = DecompressPuzzle(buffer, 3);
                    decompPuzzle[revPuzIter] = rem;
                    --revPuzIter;
                }
                decompList.Add(decompPuzzle);
                trnList.Add(trn);
                ulong            puzzleHash    = SimpleHash(decompPuzzle);
                DuplicatePuzzles dupPuzzleList = null;
                if (wi.dupPuzzles.TryGetValue(puzzleHash, out dupPuzzleList))
                {
                    dupPuzzleList.identicalPuzzles.Add(puzzleNumber);
                }
                else
                {
                    ulong revHash = ReverseSimpleHash(decompPuzzle, wi.puzHeight, wi.puzWidth);
                    dupPuzzleList = new DuplicatePuzzles();
                    // don't bother with mirrors
                    dupPuzzleList.oppositeHash = (revHash != puzzleHash) ? revHash : 0;
                    dupPuzzleList.identicalPuzzles.Add(puzzleNumber);
                    wi.dupPuzzles.Add(puzzleHash, dupPuzzleList);
                }
            }
        }
コード例 #10
0
ファイル: MonsterSpawner.cs プロジェクト: zzhXD/ATD
    //用于查询某一关卡出现的怪物种类
    public List <int> GetMonsterIDsInOneWave()
    {
        List <int>      IDList          = new List <int>();
        WaveInformation waveInformation = waveQueue.Peek();

        //每一个怪物列表
        foreach (var monsterList in waveInformation.monsterLists)
        {
            int ID = monsterList.monsterID;

            if (!IDList.Contains(ID))
            {
                IDList.Add(ID);
            }
        }
        return(IDList);
    }
コード例 #11
0
	void Update () {
		if (!gameStartPlayed && fadeEffect.fadeInFinish) {
			PlayTextMessage (GAME_START);
			gameStartPlayed = true;
		}
		
		timer += Time.deltaTime;
		waveTime += Time.deltaTime;
		if (next != null) {
			while (next != null && waveTime >= next.bornTime) {
				Character c = next.monster.GetComponent<Character> ();
				Vector3 charPosition;
				//charPosition = Map.GetRealPosition (next.bornPos, typeof(Enemy), c.offset);
				if(c.gameObject.tag=="Enemy") {
					Enemy e = c as Enemy;
					charPosition = Map.GetRealPosition (next.bornPos, typeof(Enemy), e.offset);
					ApplicationModel.currentEnemyNum++;
					if(next.waveItemType==4) { // boss
						PlaySound(BOSS_MUSIC);
					}
				}
				else {
					charPosition = Map.GetRealPosition (next.bornPos, typeof(Enemy));
				}
				
				//Enemy enemy = next.monster.GetComponent<Enemy> ();
				
				//Vector3 enemyPosition = Map.GetRealPosition (next.bornPos, typeof(Enemy), enemy.offset);
				//Debug.Log (enemy.offset);
				Quaternion charRotation = Quaternion.Euler (0f, 0f, 0f);
				c = ((GameObject)Instantiate (next.monster, charPosition, charRotation)).GetComponent<Character> ();
				c.pos = next.bornPos;
				Map.Create (c);
				next = wave.Next ();
			}
		}
		if(!end && player.isDead) {
			Debug.Log("Game Over!");
			end = true;
			level.End(false);
			PlayTextMessage(GAME_OVER);
			PlaySound(OVER_SOUND);
			Invoke("ReturnToMap", 3f);
		}
		else if(timer > Time.deltaTime && next==null  && !end && ApplicationModel.currentEnemyNum<=0 ) {
			if (!wave.NextWave ()) {
				Debug.Log ("You win!");
				end = true;
				level.End (true);
				PlayTextMessage (GAME_CLEAR);
				PlaySound (CLEAR_SOUND);
				Debug.Log ("Duration: " + level.GetPlayDurationMillis ());
				Debug.Log ("Fastest: " + level.GetFastestDurationMillis ());
				Invoke ("ReturnToMap", 3f);
			} else {
				waveTime = 0;
				next = wave.Next ();
			}
		}
		
	}
コード例 #12
0
        /*
         * IQ Final RNG
         * rand RNG is never seeded (no calls to srand, seed is only directly written to 0 it out on startup), rand is called once per frame during the game selection screens and while on a screen with a spinning globe
         *
         * At the start of the game before the first stage starts, one more actual RNG number is taken. This number is multiplied by 5 and has 1 added is used to seed the puzzle RNG. For every puzzle that needs generating, the updated number is again multiplied by 5 and has 1 added to it. The new number replaces the old seed, and its lower 16 bits are then mathed to a number between 0 and the number of puzzles.
         * */

        static public ushort DetermineWhichPuzzle(uint arg, WaveInformation wi)
        {
            ushort numPuzzles        = wi.numPuzzles; // this is lw $v0, dword_1F800050; lw $v0, 0xDBC($v0); lh $v1, 6($v0)
            int    puzzlesToDivBy100 = 500;           // li      $v0, 500

            /*
             * bne     $v1, $v0, loc_800438B8
             * li      $a3, 200
             * li      $a3, 100*/
            uint divisor      = (numPuzzles != puzzlesToDivBy100) ? 200u : 100u; // the above sequence
            uint multiplicand = 0x51eb851f;                                      // li      $a2, 0x51EB851F

            arg &= 0xffff;
            // all this divide by 50, then multiplies by 50
            ulong mulRes     = UBigMul(arg, multiplicand); // multu
            uint  highRes    = (uint)(mulRes >> 32);       // mfhi
            uint  twoPercent = highRes >> 4;               // srl     $v1, $t0, 4
            uint  runningVal = twoPercent << 1;            // sll     $v0, $v1, 1

            runningVal  += twoPercent;                     // addu    $v0, $v1
            runningVal <<= 3;                              //sll     $v0, 3
            runningVal  += twoPercent;                     // addu    $v0, $v1
            runningVal <<= 1;                              // sll     $v0, 1
            arg         -= runningVal;                     // subu    $a0, $v0
            arg         &= 0xffff;                         // andi a0, 0xffff
            uint a1 = twoPercent;

            if (arg < 23)
            {
                // if above =
                // sltiu   $v0, $a0, 23     # v0 = (a0 < 23)
                // beqz    $v0, loc_80043930  # jump if not (a0 >= 23)
                // move    $a1, $v1         # a1 = 2%
                //
                // div     $v0, $a3
                // mfhi    $v1
                // move    $a1, $v1
                uint a1Anded = a1 & 0xffff;
                a1 = a1Anded % divisor;
            }
            else if (arg < 38)
            {
                arg = a1 & 0xffff;
                // else if above =
                // sltiu   $v0, $a0, 38
                // beqz    $v0, loc_80043968
                mulRes  = UBigMul(arg, multiplicand); // multu   $a0, $a2
                highRes = (uint)(mulRes >> 32);       // mfhi
                uint halfPercent = highRes >> 6;      // srl     $v1, $t0, 6
                runningVal   = halfPercent << 1;      // sll     $v0, $v1, 1
                runningVal  += halfPercent;           // addu    $v0, $v1
                runningVal <<= 3;                     //sll     $v0, 3
                runningVal  += halfPercent;           // addu    $v0, $v1
                runningVal <<= 3;                     // sll     $v0, 3
                arg         -= runningVal;            // subu    $a0, $v0
                a1           = divisor + arg;         // addu    $a1, $a3, $a0
            }
            else // arg >= 38
            {
                arg     = a1 & 0xffff;
                mulRes  = UBigMul(arg, multiplicand); // multu   $a0, $a2
                highRes = (uint)(mulRes >> 32);       // mfhi
                uint halfPercent = highRes >> 6;      // srl     $v1, $t0, 6
                runningVal   = halfPercent << 1;      // sll     $v0, $v1, 1
                runningVal  += halfPercent;           // addu    $v0, $v1
                runningVal <<= 3;                     //sll     $v0, 3
                runningVal  += halfPercent;           // addu    $v0, $v1
                runningVal <<= 3;                     // sll     $v0, 3
                arg         -= runningVal;            // subu    $a0, $v0
                uint temp = divisor + 200;
                a1 = arg + temp;
            }
            // this is 80043994
            uint temp2 = a1 & 0xffff; // andi    $v0, $a1, 0xFFFF

            while (temp2 >= numPuzzles)
            {
                a1   -= 200;
                temp2 = a1 & 0xffff;
            }
            //a1 += 200;
            return((ushort)(a1 & 0xffffu));
        }
コード例 #13
0
        static public void DumpPuzzles()
        {
            DumpUnusedPuzzles();
            return;

            byte[]     puzzlesDemo = File.ReadAllBytes(@"F:\Dev-Cpp\Projects\CSharp\IQTracker\KurushRNG\IQFinalDemo-question.cmp");
            byte[]     puzzles = File.ReadAllBytes(@"F:\Dev-Cpp\Projects\CSharp\IQTracker\KurushRNG\IQFinal-question.cmp");
            List <int> puzzlePosDemo = GetPuzzleOffsets(puzzlesDemo);
            List <int> puzzlePos = GetPuzzleOffsets(puzzles);
            int        totalCubes = 0;
            int        advanCubes = 0;
            int        forbidCubes = 0;
            int        lastWaveId = -1;
            float      totalAverage = 0;
            int        totalTRNChanges = 0, puzChecked = 0;

            foreach (WaveInformation wi in waves)
            {
                if (wi.waveIndex == lastWaveId)
                {
                    continue;
                }
                Dictionary <int, TRNChange> trnChanges = new Dictionary <int, TRNChange>();
                lastWaveId = wi.waveIndex;
                DecompWavePuzzles(wi, puzzles, puzzlePos);
                WaveInformation wiDemo = new WaveInformation(wi);
                DecompWavePuzzles(wiDemo, puzzlesDemo, puzzlePosDemo);
                int loopEnd = wi.numPuzzles;
                for (int i = 0; i < loopEnd; ++i)
                {
                    ++puzChecked;
                    int       trnDiff = wiDemo.trns[i] - wi.trns[i];
                    TRNChange changedPuzzles;
                    if (trnDiff != 0)
                    {
                        ++totalTRNChanges;
                        if (!trnChanges.TryGetValue(trnDiff, out changedPuzzles))
                        {
                            changedPuzzles = new TRNChange();
                            trnChanges.Add(trnDiff, changedPuzzles);
                        }
                        changedPuzzles.puzNum.Add(i);
                    }
                    if ((loopEnd == 600) && (i == 199))
                    {
                        i = 399;
                    }
                    else if ((loopEnd == 500) && (i == 99))
                    {
                        i = 299;
                    }
                }
                if (trnChanges.Count > 0)
                {
                    Console.WriteLine("TRN Diffs for {0}x{1} (negative = puzzle got easier)", wi.puzWidth, wi.puzHeight);
                    foreach (KeyValuePair <int, TRNChange> trnDiff in trnChanges)
                    {
                        List <int>    changedPuzzles = trnDiff.Value.puzNum;
                        StringBuilder sb             = new StringBuilder();
                        foreach (int puzNum in changedPuzzles)
                        {
                            sb.AppendFormat("{0}, ", puzNum);
                        }
                        sb.Length -= 2;
                        Console.WriteLine("Demo has {0} turns - {1} puzzles ({2})", trnDiff.Key, changedPuzzles.Count, sb.ToString());
                    }
                }
                //KurushRNG.Program.TRNStats trnStats;
                //KurushRNG.Program.PuzzleStats puzStats = WritePuzzles(wi, out trnStats);
                //totalCubes += puzStats.totalPuzzleCubes;
                //advanCubes += puzStats.advanCubes;
                //forbidCubes += puzStats.forbiddenCubes;
                //totalAverage += trnStats.average;
            }
            Console.WriteLine("{0}/{1} puzzles had their TRN changed", totalTRNChanges, puzChecked);
            totalAverage /= waves.Length;
            int normalCubes = totalCubes - advanCubes - forbidCubes;

            Console.WriteLine("I.Q. Final stats:");
            Console.WriteLine("Average TRN of the game: {0:f2}", totalAverage);
            Console.WriteLine("Total advan cubes: {0} ({1:f2}%)", advanCubes, (((float)advanCubes / totalCubes) * 100.0f));
            Console.WriteLine("Total forbid cubes: {0} ({1:f2}%)", forbidCubes, (((float)forbidCubes / totalCubes) * 100.0f));
            Console.WriteLine("Total normal cubes: {0} ({1:f2}%)", normalCubes, (((float)normalCubes / totalCubes) * 100.0f));
            Console.WriteLine();
        }
コード例 #14
0
ファイル: IQMania.cs プロジェクト: adeyblue/IQTools
        static public void DumpPuzzles()
        {
            WaveInformation[] waves = new WaveInformation[]
            {
                // unused
                new WaveInformation(1, 4, 2, 0x2, 0, 0x190),
                // Stage 1
                new WaveInformation(1, 4, 3, 0x3, 0x190, 0x190),
                new WaveInformation(2, 4, 4, 0x4, 0x320, 0x190),
                new WaveInformation(3, 4, 5, 0x5, 0x4b0, 0x258),
                new WaveInformation(4, 4, 6, 0x6, 0x708, 0x258),
                // Stage 2
                new WaveInformation(5, 5, 5, 0x5, 0x960, 0x262),
                new WaveInformation(6, 5, 6, 0x6, 0xbc2, 0x262),
                // Stage 3
                new WaveInformation(7, 5, 7, 0x7, 0xe24, 0x260),
                new WaveInformation(8, 5, 8, 0x8, 0x1084, 0x20d),
                // Stage 4
                new WaveInformation(9, 6, 6, 0x6, 0x1291, 0x268),
                new WaveInformation(10, 6, 7, 0x7, 0x14f9, 0x265),
                // Stage 5
                new WaveInformation(11, 6, 8, 0x8, 0x175e, 0x263),
                new WaveInformation(12, 6, 9, 0x9, 0x19c1, 0x201),
                // Stage 6
                new WaveInformation(13, 7, 7, 0x7, 0x1bc2, 0x263),
                new WaveInformation(14, 7, 8, 0x8, 0x1e25, 0x260),
                // Stage 7
                new WaveInformation(15, 7, 9, 0x9, 0x2085, 0x25f),
                new WaveInformation(16, 7, 10, 0xa, 0x22e4, 0xd4),
                // Stage 8
                new WaveInformation(17, 8, 9, 0x9, 0x23b8, 0xca),
                new WaveInformation(18, 8, 10, 0xa, 0x2482, 0xd1),
                // Stage 9
                new WaveInformation(19, 9, 10, 0xa, 0x2553, 0x7c)
            };
            byte[]     puzzles      = File.ReadAllBytes(@"F:\Dev-Cpp\Projects\CSharp\IQTracker\KurushRNG\IQMania-remix.cmp");
            List <int> puzzlePos    = IQFinal.Program.GetPuzzleOffsets(puzzles);
            int        totalCubes   = 0;
            int        advanCubes   = 0;
            int        forbidCubes  = 0;
            float      totalAverage = 0;

            foreach (WaveInformation wi in waves)
            {
                DecompWavePuzzles(wi, puzzles, puzzlePos);
                KurushRNG.Program.TRNStats    trnStats;
                KurushRNG.Program.PuzzleStats puzStats = WritePuzzles(wi, out trnStats);
                totalCubes   += puzStats.totalPuzzleCubes;
                advanCubes   += puzStats.advanCubes;
                forbidCubes  += puzStats.forbiddenCubes;
                totalAverage += trnStats.average;
            }
            totalAverage /= waves.Length;
            int normalCubes = totalCubes - advanCubes - forbidCubes;

            Console.WriteLine("I.Q. Mania stats:");
            Console.WriteLine("Average TRN of the game: {0:f2}", totalAverage);
            Console.WriteLine("Total advan cubes: {0} ({1:f2}%)", advanCubes, (((float)advanCubes / totalCubes) * 100.0f));
            Console.WriteLine("Total forbid cubes: {0} ({1:f2}%)", forbidCubes, (((float)forbidCubes / totalCubes) * 100.0f));
            Console.WriteLine("Total normal cubes: {0} ({1:f2}%)", normalCubes, (((float)normalCubes / totalCubes) * 100.0f));
            Console.WriteLine();
        }
コード例 #15
0
    void level()
    {
        int missionCount = 4;

        for (int i = 0; i < missionCount; ++i)
        {
            List <MonsterList> onelist = new List <MonsterList>();
                        //获取某个关卡的怪物列表
            if (i == 0)
            {
                for (int j = 0; j < 2; j++)
                {
                    if (j == 0)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 2;
                        m.count     = 5;
                        onelist.Add(m);
                    }
                    else if (j == 1)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 1;
                        m.count     = 5;
                        onelist.Add(m);
                    }
                }

                //生成某个关卡的数据
                WaveInformation waveInformation = new WaveInformation();
                waveInformation.time         = 3;
                waveInformation.monsterLists = onelist;

                waveQueue.Enqueue(waveInformation);
            }
            else if (i == 1)
            {
                for (int j = 0; j < 6; j++)
                {
                    if (j == 0)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 2;
                        m.count     = 2;
                        onelist.Add(m);
                    }
                    else if (j == 1)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 1;
                        m.count     = 2;
                        onelist.Add(m);
                    }
                    else if (j == 2)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 2;
                        m.count     = 2;
                        onelist.Add(m);
                    }
                    else if (j == 3)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 1;
                        m.count     = 2;
                        onelist.Add(m);
                    }
                    else if (j == 4)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 2;
                        m.count     = 2;
                        onelist.Add(m);
                    }
                    else if (j == 5)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 1;
                        m.count     = 2;
                        onelist.Add(m);
                    }
                }

                //生成某个关卡的数据
                WaveInformation waveInformation = new WaveInformation();
                waveInformation.time         = 8;
                waveInformation.monsterLists = onelist;

                waveQueue.Enqueue(waveInformation);
            }
            else if (i == 2)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (j == 0)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 2;
                        m.count     = 5;
                        onelist.Add(m);
                    }
                    else if (j == 1)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 1;
                        m.count     = 5;
                        onelist.Add(m);
                    }
                    else if (j == 2)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 2;
                        m.count     = 5;
                        onelist.Add(m);
                    }
                    else if (j == 3)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 1;
                        m.count     = 5;
                        onelist.Add(m);
                    }
                }

                //生成某个关卡的数据
                WaveInformation waveInformation = new WaveInformation();
                waveInformation.time         = 8;
                waveInformation.monsterLists = onelist;

                waveQueue.Enqueue(waveInformation);
            }
            else if (i == 3)
            {
                for (int j = 0; j < 2; j++)
                {
                    if (j == 0)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 2;
                        m.count     = 15;
                        onelist.Add(m);
                    }
                    else if (j == 1)
                    {
                        MonsterList m = new MonsterList();
                        m.monsterID = 1;
                        m.rate      = 1;
                        m.wayID     = 1;
                        m.count     = 15;
                        onelist.Add(m);
                    }
                }

                //生成某个关卡的数据
                WaveInformation waveInformation = new WaveInformation();
                waveInformation.time         = 8;
                waveInformation.monsterLists = onelist;

                waveQueue.Enqueue(waveInformation);
            }
        }
    }