Пример #1
0
        /// <summary>
        /// Delete level from scene
        /// </summary>
        public void DeleteLevel()
        {
            GameObject oldLevel = GameObject.FindGameObjectWithTag("Level");

            if (oldLevel != null)
            {
                Destroy(oldLevel);
                LevelData = null;
            }
        }
        /// <summary>
        /// Set player's data (for the level)
        /// </summary>
        public void SetPlayerData()
        {
            LevelProvider lvl = LevelManager.Instance.LevelData;

            if (lvl == null)
            {
                Debug.Log("Level is not available!");
                GameManager.Instance.SwitchState("Loadout");
                return;
            }

            transform.position = lvl.PlayerStartPosition.position;

            Steps = lvl.MaxSteps;

            grid         = lvl.Grid;
            tilemap      = lvl.Tilemap;
            RouteBuilder = lvl.RouteBuilder;

            DestroyPlayerGO();
            CreatePlayerGO();

            animator = currentPlayerGO.GetComponent <Animator>();
        }
Пример #3
0
        /// <summary>
        /// Create new level
        /// </summary>
        private void CreateLevel()
        {
            GameObject newLevelGO = Instantiate(currentLevel.levelPrefab);

            LevelData = newLevelGO.GetComponent <LevelProvider>();
        }