예제 #1
0
 // Constructors:
 public ServerGame(MultiplayerLevel multiplayerLevel) : base(multiplayerLevel)
 {
     Player           = new PlayerModel(multiplayerLevel.PlayerInfo, Field, game: this);
     Player.DieEvent += () =>
     {
         GameState.Lose();
         CloseMessage = true;
     };
     //
     Opponent           = new PlayerModel(multiplayerLevel.SecondPlayerInfo, Field, game: this);
     Opponent.DieEvent += () =>
     {
         GameState.Win();
         CloseMessage = true;
     };
     //
     NPCs = new List <NPCModel>();
     foreach ((int, int)position in multiplayerLevel.NPCsInfo)
     {
         NPCs.Add(
             new NPCModelMP(position,
                            Field,
                            Player,
                            game: this,
                            serverPlayer: Player,
                            clientPlayer: Opponent));
     }
     //
     GameTimer = new GameTimer(loop_function: MainLoop, interval: 100, autoReset: false);
 }
예제 #2
0
 // Constructors:
 public ClientGame(MultiplayerLevel multiplayerLevel) : base(multiplayerLevel)
 {
     Player           = new PlayerModel(position: multiplayerLevel.SecondPlayerInfo, field: Field, game: this);
     Player.DieEvent += () =>
     {
         GameState.Lose();
         CloseMessage = true;
     };
     //
     Opponent           = new PlayerModel(position: multiplayerLevel.PlayerInfo, field: Field, game: this);
     Opponent.DieEvent += () =>
     {
         GameState.Win();
         CloseMessage = true;
     };
     //
     NPCs = new List <NPCModel>();
     foreach ((int, int)position in multiplayerLevel.NPCsInfo)
     {
         NPCs.Add(
             new NPCModelMP(position,
                            Field,
                            player: Opponent,
                            game: this,
                            serverPlayer: Opponent,
                            clientPlayer: Player));
     }
 }
예제 #3
0
        // Constructor:
        public MultiPlayerGameBase(MultiplayerLevel multiplayerLevel)
            : base(multiplayerLevel.FieldInfo)
        {
            LvlName = multiplayerLevel.Name;

            Bullets = new List <Bullet>();

            ConnectToOpponent();
        }