示例#1
0
        static void TestSimulation(int seed)
        {
            // 던전 테스트--------
            Player[] player = { new Player(), new Player(), new Player(), new Player() };

            PlayerData data = new PlayerData();

            if (TestData.playerList.TryGetValue(102, out data))
            {
                player[0].LoadPlayer(data);
            }

            if (TestData.playerList.TryGetValue(103, out data))
            {
                player[1].LoadPlayer(data);
            }

            if (TestData.playerList.TryGetValue(104, out data))
            {
                player[2].LoadPlayer(data);
            }

            if (TestData.playerList.TryGetValue(101, out data))
            {
                player[3].LoadPlayer(data);
            }

            var start = time.ElapsedMilliseconds;

            Party users = new Party(PartyType.PLAYER, 1);

            foreach (Player p in player)
            {
                users.AddCharacter(p);
            }

            DungeonMaster newMaster = new DungeonMaster();

            newMaster.Init(60, seed, users);

            UpdateResult(newMaster.Start(), time.ElapsedMilliseconds - start);

            // 초기 정보 확인
            // var mapInfo = newMaster.GetMapInfo();
            // var itemList = newMaster.items;
            // var mobList = newMaster.mobs;

            // newMaster.TestPathFinding();
            // Console.ReadLine();
            // Debug.WriteLine( "turn : " + newMaster.Start() );

            // 시뮬레이션 결과 확인
            //             foreach( var each in newMaster.record.pathfinding )
            //             {
            //                 Debug.WriteLine( "x : " + each.x + " / y : " + each.y );
            //             }
            //
            // ------------------
        }
    // OperationBluehole.Content.DungeonMaster tmpMaster = new OperationBluehole.Content.DungeonMaster();
    public void GenerateLog(int size, int seed, OperationBluehole.Content.Party userParty)
    {
        // Generate Dungeon Map
        dungeonMaster.Init(size, seed, userParty);

        //////// warning!!!! ////////////////////
        // We should create deep copy method for MapObject. for now, just generate another dungeon with same seed.
        tmpMaster.Init(size, seed, userParty);
        /////////////////////////////////////////

        // Set object data
        DataManager.Instance.SetReplayMapData(userParty, dungeonMaster.mobs, dungeonMaster.items);

        // Get Dungeon Map(we generated) and Load on Client
        sceneManager.GetComponent <Loading>().LoadMap(new Dungeon(dungeonMaster.GetDungeonMap(), size));

        // Start Simulate and record results
        dungeonMaster.Start();

        // Write Log using record
        WriteLog();
    }