Example #1
0
        public override void SetLevel()
        {
            CommunityLevelHub.Instance.currentLevel = this;
            if (LevelMap.previousLevelName == levelName)
            {
                LoadLevel();
                return;
            }
            GameManager.Instance.SetPaused(true);
            for (int i = 0; i < PartOfLevelEditor.instances.Count; i++)
            {
                PartOfLevelEditor part = PartOfLevelEditor.instances[i];
                DestroyImmediate(part.gameObject);
            }
            PartOfLevelEditor[] createdParts     = PartOfLevelEditor.CreateObjects(mapData);
            List <Renderer>     createdRenderers = new List <Renderer>();

            foreach (PartOfLevelEditor part in createdParts)
            {
                createdRenderers.Add(part.GetComponent <Renderer>());
            }
            LevelMap.Instance.Make(createdRenderers.ToArray());
            CommunityLevelHub.Instance.mapNameText.text     = levelName;
            CommunityLevelHub.Instance.mapUsernameText.text = username;
            CommunityLevelHub.Instance.startButton.onClick.RemoveAllListeners();
            CommunityLevelHub.Instance.startButton.onClick.AddListener(delegate { LoadLevel(); });
            CommunityLevelHub.Instance.startButton.interactable = true;
        }
Example #2
0
 public virtual void ReloadLevel()
 {
     for (int i = 0; i < PartOfLevelEditor.instances.Count; i++)
     {
         PartOfLevelEditor part = PartOfLevelEditor.instances[i];
         DestroyImmediate(part.gameObject);
     }
     PartOfLevelEditor.CreateObjects(mapData);
 }