コード例 #1
0
            protected override void OnTick()
            {
                int sm = -1, ns = -1;

                int[] amc = new int[m_Game.m_Teams.Count];
                for (int i = 0; i < m_Game.m_Teams.Count; i++)
                {
                    amc[i] = ((CTFTeam)m_Game.m_Teams[i]).ActiveMemberCount;
                    if (sm == -1 || amc[i] < amc[sm])
                    {
                        ns = sm;
                        sm = i;
                    }
                    else if (amc[i] < amc[ns])
                    {
                        ns = i;
                    }
                }

                for (int i = 0; i < m_List.Count; i++)
                {
                    Mobile m = (Mobile)m_List[i];

                    m.Frozen = false;
                    m.CloseGump(typeof(GameTeamSelector));

                    if (m_Game.GetTeam(m) == null)
                    {
                        int t;
                        if (m.NetState == null)
                        {
                            t = Utility.Random(amc.Length);
                        }
                        else
                        {
                            if (amc[sm] >= amc[ns])
                            {
                                t = Utility.Random(amc.Length);
                            }
                            else
                            {
                                t = sm;
                            }
                            amc[t]++;
                        }

                        CTFTeam team = (CTFTeam)m_Game.m_Teams[t];

                        m_Game.SwitchTeams(m, team);
                        m.SendMessage("You have joined team {0}!", team.Name);
                    }
                }
                m_Game.ResetGame();
            }
コード例 #2
0
 public void UpdateTeam()
 {
     if (m_Game != null && m_TeamID != -1)
     {
         m_Team = m_Game.GetTeam(m_TeamID);
         if (m_Team != null)
         {
             this.Hue  = m_Team.Hue;
             this.Name = m_Team.Name + " Team Control";
         }
     }
 }
コード例 #3
0
        public static CTFTeam FindTeamFor(Mobile m)
        {
            for (int i = 0; i < m_Registry.Count; i++)
            {
                CTFGame game = (CTFGame)m_Registry[i];
                CTFTeam team = game.GetTeam(m);
                if (team != null)
                {
                    return(team);
                }
            }

            return(null);
        }