Example #1
0
 public static TeamManager createTeamforGame(string Game)
 {
     TeamManager t = new TeamManager();
     t.Game = Game;
     t.BlueTeam = new List<RoomUser>();
     t.RedTeam = new List<RoomUser>();
     t.GreenTeam = new List<RoomUser>();
     t.YellowTeam = new List<RoomUser>();
     return t;
 }
Example #2
0
 internal TeamManager GetTeamManagerForFreeze()
 {
     if (teamfreeze == null)
         teamfreeze = TeamManager.createTeamforGame("freeze");
     return teamfreeze;
 }
Example #3
0
 internal TeamManager GetTeamManagerForBanzai()
 {
     if (teambanzai == null)
         teambanzai = TeamManager.createTeamforGame("banzai");
     return teambanzai;
 }
Example #4
0
        private void FreezeUser(RoomUser user)
        {
            if (user.IsBot || user.shieldActive || user.team == Team.none)
            {
                return;
            }

            if (user.Freezed)
            {
                user.Freezed = false;
                user.ApplyEffect((int)user.team + 39);
                return;
            }
            user.Freezed       = true;
            user.FreezeCounter = 0;

            user.FreezeLives--;

            if (user.FreezeLives <= 0)
            {
                ServerMessage message2 = new ServerMessage();
                message2.Init(Outgoing.UpdateFreezeLives);
                message2.AppendInt32(user.InternalRoomID);
                message2.AppendInt32(user.FreezeLives);
                user.GetClient().SendMessage(message2);

                user.ApplyEffect(-1);
                room.GetGameManager().AddPointToTeam(user.team, -20, user);
                TeamManager t = room.GetTeamManagerForFreeze();
                t.OnUserLeave(user);
                user.team = Team.none;
                if (exitTeleport != null)
                {
                    room.GetGameMap().TeleportToItem(user, exitTeleport);
                }

                user.Freezed      = false;
                user.SetStep      = false;
                user.IsWalking    = false;
                user.UpdateNeeded = true;

                if (t.BlueTeam.Count <= 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count > 0)
                {
                    this.StopGame(); // yellow team win
                }
                else if (t.BlueTeam.Count > 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count <= 0)
                {
                    this.StopGame(); // blue team win
                }
                else if (t.BlueTeam.Count <= 0 && t.RedTeam.Count > 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count <= 0)
                {
                    this.StopGame(); // red team win
                }
                else if (t.BlueTeam.Count <= 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count > 0 && t.YellowTeam.Count <= 0)
                {
                    this.StopGame(); // green team win
                }
                return;
            }

            room.GetGameManager().AddPointToTeam(user.team, -10, user);
            user.ApplyEffect(12);

            ServerMessage message = new ServerMessage();

            message.Init(Outgoing.UpdateFreezeLives);
            message.AppendInt32(user.InternalRoomID);
            message.AppendInt32(user.FreezeLives);

            user.GetClient().SendMessage(message);
        }