Ejemplo n.º 1
0
    private void LoadReplayInfo()
    {
        // Init
        OperationBluehole.Content.ContentsPrepare.Init();
        OperationBluehole.Content.Player[] players = { new OperationBluehole.Content.Player(), new OperationBluehole.Content.Player(), new OperationBluehole.Content.Player(), new OperationBluehole.Content.Player() };

        // Warning!!! There is no information about mobPartyLevel in simulation result.
        // use temp variable
        int tempMobPartyLevel = 3;

        OperationBluehole.Content.Party playerParty = new OperationBluehole.Content.Party(OperationBluehole.Content.PartyType.PLAYER, tempMobPartyLevel);

        for (int i = 0; i < DataManager.Instance.latestSimulationResult.playerList.Count; ++i)
        {
            if (DataManager.Instance.latestSimulationResult.playerList[i] == null)
            {
                Debug.LogError("No Player " + i);
            }
            players[i].LoadPlayer(DataManager.Instance.latestSimulationResult.playerList[i]);
            playerParty.AddCharacter(players[i]);
        }

        LogGenerator.Instance.GenerateLog(
            DataManager.Instance.latestSimulationResult.mapSize,
            DataManager.Instance.latestSimulationResult.randomSeed,
            playerParty
            );
    }
    // Get Enemy Group Data from data manager class
    private void InitBattleObjects(int mobId)
    {
        enemyGroupData = DataManager.Instance.EncounteredMobPartyList[mobId];

        //      // Create object pool in first battle
        //      if ( isInitialized )
        //          return;
        //
        //      // Create object pool for battle area
        //      LgsObjectPoolManager.Instance.CreateObjectPool( enemyPrefab.name , enemyPrefab , 10 );
        //
        //      // Set initilize flag
        //      isInitialized = true;
    }
Ejemplo n.º 3
0
    public void EndBattle(OperationBluehole.Content.Party mobParty)
    {
        ++counter;
        Debug.Log(counter);
        int        mobIndex    = mobParty.position.y * MapManager.Instance.InstanceDungeon.size + mobParty.position.x;
        GameObject mobInstance = null;

        if (!MapManager.Instance.MobDictionary.TryGetValue(mobIndex, out mobInstance))
        {
            Debug.LogError("Error : Mob list index is not exist");
        }

        // If we win the battle, deactivate mob
        mobInstance.SetActive(false);
        ++battleLogIterator;
        BattleManager.Instance.CleanBattleArea();
        PlayMapLog();
    }
Ejemplo n.º 4
0
    // 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();
    }
Ejemplo n.º 5
0
 // Set Encountered Mob Data
 private LogInfo MakeBattleLog(OperationBluehole.Content.Party mobParty)
 {
     DataManager.Instance.EncounteredMobPartyList.Add(mobParty);
     return(new LogInfo(LogType.Battle, battleLogIndex++));
 }
Ejemplo n.º 6
0
 public void SetReplayMapData(OperationBluehole.Content.Party userParty, List <OperationBluehole.Content.Party> mobPartyList, List <OperationBluehole.Content.Item> itemList)
 {
     this.UserParty    = userParty;
     this.MobPartyList = mobPartyList;
     this.ItemList     = itemList;
 }
Ejemplo n.º 7
0
        public bool Move(MoveDiretion direction, GameRecord record)
        {
            switch (direction)
            {
            case MoveDiretion.DOWN:
                position = new Int2D(position.x, position.y + 1);
                break;

            case MoveDiretion.LEFT:
                position = new Int2D(position.x - 1, position.y);
                break;

            case MoveDiretion.RIGHT:
                position = new Int2D(position.x + 1, position.y);
                break;

            case MoveDiretion.UP:
                position = new Int2D(position.x, position.y - 1);
                break;

            default:
                break;
            }

            // 일단 도착했으니까 제거
            if (position.Equals(currentMovePath.Peek()))
            {
                currentMovePath.Pop();
            }

            // 몹이 있는지 확인한다
            // 있으면 일단 전투부터 요청
            Party target = dungeonMaster.GetMapObject(position.x, position.y).party;

            if (target != null && target.partyType == PartyType.MOB)
            {
                if (!dungeonMaster.StartBattle(target))
                {
                    record.lastPosition = position;

                    return(false);
                }
            }

            // 아이템 있는지 확인한다
            Item item = (Item)dungeonMaster.GetMapObject(position.x, position.y).gameObject;

            if (item != null)
            {
                if (item.code == ItemCode.Ring)
                {
                    isRingDiscovered = true;
                }
                else
                {
                    dungeonMaster.LootItem(item, currentZoneId);
                    UpdateDestination();
                }
            }

            // 현재 존 정보 업데이트 할 것
            int newZoneId = dungeonMaster.GetZoneId(position);

            if (currentZoneId != newZoneId)
            {
                // 영역이 바뀌었다!
                currentZoneId = newZoneId;

                UpdateDestination();

                // 처음 가보는 곳이면 일단 스택에도 넣고, 가봤다고 기록도 하자
                if (!exploredZone.Contains(currentZoneId))
                {
                    dungeonZoneHistory.Push(currentZoneId);
                    exploredZone.Add(currentZoneId);
                }
            }

            return(true);
        }