示例#1
0
        private static IEnumerator CheckGameEndI()
        {
            yield return(new WaitForSeconds(0.05f));

            if (PhotonNetwork.IsMasterClient && CheckPvpWinner())
            {
                yield break;
            }

            if (PhotonNetwork.IsMasterClient && FengGameManagerMKII.IsPlayerAllDead())
            {
                FengGameManagerMKII.FGM.GameLose();
            }
        }
示例#2
0
 private void SpawnHero()
 {
     CheckBoxCostume.costumeSet             = costumeSelection.ToValue() + 1;
     FengGameManagerMKII.FGM.needChooseSide = false;
     if (IN_GAME_MAIN_CAMERA.GameMode == GameMode.PVP_CAPTURE)
     {
         FengGameManagerMKII.FGM.checkpoint = CacheGameObject.Find("PVPchkPtH");
     }
     if (!PhotonNetwork.IsMasterClient && FengGameManagerMKII.FGM.logic.RoundTime > 60f)
     {
         if (!FengGameManagerMKII.IsPlayerAllDead())
         {
             FengGameManagerMKII.FGM.NotSpawnPlayer(character);
         }
         else
         {
             FengGameManagerMKII.FGM.NotSpawnPlayer(character);
             FengGameManagerMKII.FGM.BasePV.RPC("restartGameByClient", PhotonTargets.MasterClient, new object[0]);
         }
     }
     else if (IN_GAME_MAIN_CAMERA.GameMode == GameMode.BossFightCT || IN_GAME_MAIN_CAMERA.GameMode == GameMode.Trost || IN_GAME_MAIN_CAMERA.GameMode == GameMode.PVP_CAPTURE)
     {
         if (FengGameManagerMKII.IsPlayerAllDead())
         {
             FengGameManagerMKII.FGM.NotSpawnPlayer(character);
             FengGameManagerMKII.FGM.BasePV.RPC("restartGameByClient", PhotonTargets.MasterClient, new object[0]);
         }
         else
         {
             FengGameManagerMKII.FGM.SpawnPlayer(character);
         }
     }
     else
     {
         FengGameManagerMKII.FGM.SpawnPlayer(character);
     }
     IN_GAME_MAIN_CAMERA.usingTitan = false;
     IN_GAME_MAIN_CAMERA.MainCamera.setHUDposition();
     PhotonNetwork.player.Character = character;
 }
示例#3
0
        private static bool CheckPvpWinner()
        {
            if ((!BombMode.Enabled && !BladePvp.Enabled && !TeamMode.Enabled && !PointMode.Enabled) || FengGameManagerMKII.FGM.IsWinning)
            {
                return(false);
            }
            if (!TeamMode.Enabled)
            {
                if (!PointMode.Enabled)
                {
                    List <PhotonPlayer> alives = PhotonNetwork.playerList.Where(player => !player.Dead).ToList();
                    if (alives.Count > 1)
                    {
                        return(false);
                    }
                    FengGameManagerMKII.FGM.GameWin();
                    if (alives.Count > 0)
                    {
                        Chat.SendLocalizedTextAll("GameModes", "playerWin", new[] { alives[0].UIName.ToHTMLFormat() });
                    }
                    else
                    {
                        Chat.SendLocalizedTextAll("GameModes", "nobodyWin", new string[0]);
                    }
                    if (alives.Count > 0)
                    {
                        alives[0].Kills += 5;
                    }
                }
                else
                {
                    if (FengGameManagerMKII.IsPlayerAllDead() && !EndlessRespawn.Enabled)
                    {
                        FengGameManagerMKII.FGM.GameLose();
                        return(true);
                    }
                    foreach (PhotonPlayer player in PhotonNetwork.playerList)
                    {
                        if (player.Kills >= PointMode.GetInt(0))
                        {
                            FengGameManagerMKII.FGM.GameWin();
                            Chat.SendLocalizedTextAll("GameModes", "playerWin", new[] { player.UIName.ToHTMLFormat() });
                            break;
                        }
                    }
                }
                return(true);
            }
            bool teamCyanWin    = false;
            bool teamMagentaWin = false;

            if (PointMode.Enabled)
            {
                int cyanKills    = 0;
                int magentaKills = 0;
                foreach (PhotonPlayer player in PhotonNetwork.playerList)
                {
                    switch (player.RCteam)
                    {
                    case 1:
                        cyanKills += player.Kills;
                        break;

                    case 2:
                        magentaKills += player.Kills;
                        break;
                    }
                }
                if (cyanKills >= PointMode.GetInt(0))
                {
                    teamCyanWin = true;
                }
                if (magentaKills >= PointMode.GetInt(0))
                {
                    teamMagentaWin = true;
                }
                if (FengGameManagerMKII.IsPlayerAllDead() && !EndlessRespawn.Enabled)
                {
                    FengGameManagerMKII.FGM.GameLose();
                    return(true);
                }
            }
            else
            {
                List <PhotonPlayer> cyan    = new List <PhotonPlayer>();
                List <PhotonPlayer> magenta = new List <PhotonPlayer>();
                foreach (PhotonPlayer player in PhotonNetwork.playerList)
                {
                    if (player.Dead)
                    {
                        continue;
                    }
                    int rcteam = player.RCteam;
                    switch (rcteam)
                    {
                    case 1:
                        cyan.Add(player);
                        break;

                    case 2:
                        magenta.Add(player);
                        break;
                    }
                }
                if (BladePvp.Enabled || BombMode.Enabled)
                {
                    if (magenta.Count < 1)
                    {
                        teamCyanWin = true;
                    }
                    else if (cyan.Count < 1)
                    {
                        teamMagentaWin = true;
                    }
                }
            }
            if (teamMagentaWin ^ teamCyanWin)
            {
                FengGameManagerMKII.FGM.GameWin();
                Chat.SendLocalizedTextAll("GameModes", (teamCyanWin ? "cyan" : "magenta") + "Win", new string[0]);
                return(true);
            }

            if (teamMagentaWin && teamCyanWin)
            {
                FengGameManagerMKII.FGM.GameWin();
                Chat.SendLocalizedTextAll("GameModes", "nobodyWin", new string[0]);
                return(true);
            }
            return(false);
        }