void Awake()
        {
            instance = this;

            playersController = GetComponent <PlayersController>();
            build             = GetComponent <Controls.Build>();

            cameraMover      = FindObjectOfType <Controls.CameraMover>();
            cachedMainCamera = Camera.main;

            playersController.PreAwake();

            if (mapSettings != null && mapSettings.isThisMapForSingleplayer)
            {
                MatchSettings.currentMatchSettings = new MatchSettings();
                MatchSettings.currentMatchSettings.playersSettings = mapSettings.playersSettingsForSingleplayer;
                MatchSettings.currentMatchSettings.SelectMap(mapSettings);
            }
            else if (MatchSettings.currentMatchSettings == null)
            {
                Debug.LogWarning("<b>You can run non-singleplayer map only from Lobby.</b> To test map correctly - save it, open Lobby scene, select players, and run map.");
                SceneManager.LoadScene(0);
                return;
            }

            if (mapSettings == null)
            {
                mapSettings = MatchSettings.currentMatchSettings.selectedMap;
            }

            Controls.Selection.Initialize();

            if (Unit.allUnits != null)
            {
                Unit.allUnits.Clear();
            }

            UI.Healthbar.ResetPool();

            InitializePlayers();

            if (mapBorderRenderer)
            {
                mapBorderRenderer.material.SetInt("_MapSize", MatchSettings.currentMatchSettings.selectedMap.mapSize);

                if (!MainStorage.showMapBorders)
                {
                    mapBorderRenderer.enabled = false;
                }
            }

            textsLibrary = storage.textsLibrary;

            if (!textsLibrary)
            {
                Debug.LogWarning("<b>No Texts Library added to the Storage.</b> Please, add it, otherwise possible game texts problems.");
            }
        }
Beispiel #2
0
 public void SelectMap(MapSettings selectedMap)
 {
     this.selectedMap = selectedMap;
 }