示例#1
0
        public void Start()
        {
            UpTick   = 0;
            DownTick = 1800000;
            LastTick = -1;

            Objects.Map map       = Managers.MapManager.Instance.Get(Map);
            byte        flagCount = map.Flags;

            byte[] spawnFlags = map.SpawnFlags;
            this.Flags = new sbyte[flagCount];
            for (byte i = 0; i < 0; i++)
            {
                Flags[i] = -1;
            }

            Flags[spawnFlags[0]] = 0;
            Flags[spawnFlags[1]] = 1;


            foreach (Player p in Players.Values)
            {
                p.Reset();
                p.RoundStart();
            }

            switch (Mode)
            {
            case Enums.Mode.Explosive: {
                CurrentGameMode = new Modes.Explosive();
                break;
            }

            case Enums.Mode.Free_For_All: {
                CurrentGameMode = new Modes.FreeForAll();
                break;
            }

            case Enums.Mode.Team_Death_Match: {
                CurrentGameMode = new Modes.TeamDeathMatch();
                break;
            }
            }

            CurrentGameMode.Initilize(this);
            Running = false;
        }
        /*
         *  public void Send(byte[] buffer)
         * {
         *  foreach(Entities.Player Player in Players.Values)
         *  {
         *      if (Player != null)
         *          Player.Send(buffer);
         *  }
         *
         *  foreach(Entities.User Spectator in Spectators.Values)
         *  {
         *      if (Spectator != null)
         *          Spectator.Send(buffer);
         *  }
         * }
         */
        public void Start()
        {
            UpTick   = 0;
            DownTick = 1800000;
            LastTick = -1;

            Objects.Map map       = Managers.MapManager.Instance.Get(Map);
            byte        flagCount = map.Flags;

            byte[] spawnFlags = map.SpawnFlags;
            this.SpawnFlags = spawnFlags;
            this.Flags      = new sbyte[flagCount];
            for (byte i = 0; i < flagCount; i++)
            {
                Flags[i] = -1;
            }

            Flags[spawnFlags[0]] = 0;
            Flags[spawnFlags[1]] = 1;

            Vehicles = Managers.VehicleManager.Instance.BuildArray(map.Id, map.VehicleCount);

            for (byte i = 0; i < Vehicles.Count; i++)
            {
                List <Objects.VehicleSeat> SheetSeats = Managers.VehicleManager.Instance.GetSeatsFor(Vehicles[i].Code);

                foreach (Objects.VehicleSeat SheetSeat in SheetSeats)
                {
                    Objects.VehicleSeat NewSeat = new Objects.VehicleSeat(SheetSeat.ID, SheetSeat.SeatCode, SheetSeat.VehicleCode,
                                                                          SheetSeat.Weapon1Ammo, SheetSeat.Weapon2Ammo, SheetSeat.Weapon1Mag, SheetSeat.Weapon2Mag, SheetSeat.Weapons);

                    Vehicles[i].AddSeat(NewSeat);
                }
            }


            foreach (Player p in Players.Values)
            {
                p.Reset();
                p.RoundStart();
            }

            switch (Mode)
            {
            case Enums.Mode.Explosive: {
                CurrentGameMode = new Modes.Explosive();
                break;
            }

            case Enums.Mode.Free_For_All: {
                CurrentGameMode = new Modes.FreeForAll();
                break;
            }

            case Enums.Mode.Team_Death_Match: {
                CurrentGameMode = new Modes.TeamDeathMatch();
                break;
            }

            case Enums.Mode.Conquest:
            {
                CurrentGameMode = new Modes.Conquest();
                break;
            }
            }
            this.ItemsOnGround.Clear();
            CurrentGameMode.Initilize(this);
            Running = false;
        }