예제 #1
0
        public GameRule CreateRule()
        {
            string[] teamnames = Array.FindAll<string>(Teams.Lines, delegate(string s1) { return s1.Length > 0; });

            if (teamnames.Length < 2)
                throw new Exception();

            CtfTeam[] teams = new CtfTeam[teamnames.Length];
            for (int i = 0; i < teams.Length; ++i)
            {
                teams[i] = new CtfTeam(i, teamnames[i]);
            }

            return new CaptureTheFlag(
                teams,
                (int)CaptureLimit.Value,
                (float)TimeLimit.Value * 60
                );
        }
예제 #2
0
        protected GameRule CreateCaptureTheFlag()
        {
            Config c = Root.Instance.ResourceManager.LoadConfig("config/global.config");

            int numteams = c.GetInteger("capturetheflag.teams");
            CtfTeam[] teams = new CtfTeam[numteams];
            for (int i = 0; i < teams.Length; ++i)
            {
                teams[i] = new CtfTeam(i, c.GetString("capturetheflag.team" + i + ".name"));
            }

            return new CaptureTheFlag(teams, c.GetInteger("capturetheflag.teamscorelimit"), c.GetFloat("capturetheflag.timelimit"));
        }