예제 #1
0
 public void RejoinMap(bool spawnjoin, bool winner)
 {
     Client.Send(new GameContextDestroyMessage());
     Client.Send(new GameContextCreateMessage(1));
     if (winner && FighterInstance.Fight.Map.DugeonMap)
     {
         var dungeonMap = DungeonRecord.GetDungeonData(FighterInstance.Fight.Map.Id);
         FighterInstance = null;
         Client.Character.Teleport(dungeonMap.TeleportMapId, dungeonMap.TeleportCellId);
         RefreshStats();
         return;
     }
     FighterInstance = null;
     if (spawnjoin && !winner)
     {
         if (Client.Character.Record.SpawnPointMapId != -1)
         {
             MapsHandler.SendCurrentMapMessage(Client, Client.Character.Record.SpawnPointMapId);
             Record.CellId = (short)InteractiveRecord.GetTeleporterCellId(Client.Character.Record.SpawnPointMapId, TeleporterTypeEnum.TELEPORTER_ZAAP);
         }
         else
         {
             Client.Character.Teleport(ConfigurationManager.Instance.StartMapId, ConfigurationManager.Instance.StartCellId);
         }
     }
     else
     {
         MapsHandler.SendCurrentMapMessage(Client, Client.Character.Record.MapId);
     }
     RefreshStats();
 }
예제 #2
0
    void Awake()
    {
        CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_WIN, Evaluate);
        CEventDispatcher.GetInstance().AddEventListener(CEventType.MOVE_TO_NEXT, UpdateWaveUI);
        CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_OVER, OnGameOver);

        instance = this;
        enabled  = false;
        DungeonRecord.Clear();
        StartCoroutine(Init());
    }
 public void SyncMonsters()
 {
     lock (this)
     {
         if (MonstersGroups.Count > 0 || Record.HaveZaap || !MapNoSpawnRecord.CanSpawn(Record.Id))
         {
             return;
         }
         AsyncRandom random = new AsyncRandom();
         if (this.Record.DugeonMap)
         {
             if (this.MonstersGroups.Count == 0)
             {
                 List <MonsterSpawnMapRecord> monsters = DungeonRecord.GetDungeonMapMonsters(this.Record.Id).ConvertAll <MonsterSpawnMapRecord>(x => new MonsterSpawnMapRecord(-1, x, this.Record.Id, 100));
                 monsters.ForEach(x => x.ActualGrade = (sbyte)random.Next(1, 6));
                 MonstersGroups.Add(new MonsterGroup(MonsterGroup.START_ID, monsters, (ushort)Record.RandomWalkableCell()));
             }
             return;
         }
         var spawns = MonsterSpawnSubRecord.GetSpawns(Record.Id);
         if (spawns.Count() == 0)
         {
             return;
         }
         for (sbyte groupId = 0; groupId < random.Next(1, MAX_MONSTER_PER_GROUP + 1); groupId++)
         {
             List <MonsterSpawnMapRecord> monsters = new List <MonsterSpawnMapRecord>();
             for (int w = 0; w < random.Next(1, MAX_MONSTER_PER_GROUP + 1); w++)
             {
                 int max  = spawns.Sum((MonsterSpawnMapRecord entry) => entry.Probability);
                 int num  = random.Next(0, max);
                 int num2 = 0;
                 foreach (var monster in spawns)
                 {
                     num2 += monster.Probability;
                     if (num <= num2)
                     {
                         monster.ActualGrade = (sbyte)random.Next(1, 6);
                         monsters.Add(monster);
                         break;
                     }
                 }
             }
             MonstersGroups.Add(new MonsterGroup(groupId + MonsterGroup.START_ID, monsters, (ushort)Record.RandomWalkableCell()));
         }
     }
 }
예제 #4
0
 void Awake()
 {
     instance = this;
     DungeonRecord.Clear();
     StartCoroutine(Init());
 }