Beispiel #1
0
        public override void Initialize()
        {
            base.Initialize();

            gunSpawns = new GunSpawnLocations();
            tiledBase.OnObjectLoaded += gunSpawns.OnObjectLoaded;

            playerSpawns              = new PlayerSpawnLocations();
            tiledBase.OnObjectLoaded += playerSpawns.OnObjectLoaded;

            sender = new NetManagerSender(port);

            serverConnection = stage.CreateActor(0).AddComponent <ServerConnectionComponent>();
            serverConnection.Set(playerSpawns, Name, stage);

            byte levelId = GameManager.GetRandomLevelNumber();

            LoadLevel(levelId);
            GameManager.currentLevel = levelId;

            stage.CreateActor(0).AddComponent <HostGameEndComponent>();
            stage.CreateActor(0).AddComponent <HostGameStartComponent>();
        }
 /// <summary>
 /// Sets important references of the ServerConnectionComponent.
 /// </summary>
 /// <param name="spawnLocations">The spawn locations of each player.</param>
 /// <param name="name">The name of the server.</param>
 /// <param name="stage">A reference to the main stage.</param>
 public void Set(PlayerSpawnLocations spawnLocations, string name, Stage stage)
 {
     this.spawnLocations = spawnLocations;
     this.name           = name;
     this.stage          = stage;
 }