Exemple #1
0
        /// <summary>
        /// Generates map in editor;
        /// </summary>
        public void GenerateLevelInEditMode()
        {
            LevelGeneration levelGen = FindObjectOfType <LevelGeneration>();

            levelGen.canGenerateInEditMode = true;
            levelGen.StartGenerating();
        }
Exemple #2
0
        //
        private void Start()
        {
            // Reference to LevelGeneration;
            levelMaker = GameManager._gameManager.levelGeneration;
            // Reference to player GameObject;
            player = GameManager._gameManager.player;
            // Check if Camera component not set in Inspector, try to check in this gameObject;
            if (_camera == null)
            {
                _camera = GetComponent <Camera>();
            }
            if (_camera == null)
            {
                Debug.Log("No Camera!");
            }
            //Reference to RigidBody2D;
            rig = player.GetComponent <Rigidbody2D>();
            // Changing Index, dependinng on Generation type;
            switch (levelMaker.generationType)
            {
            case genType._old:
                boundsOffsetIndex = 0;
                break;

            case genType._new:
                boundsOffsetIndex = 1;
                break;
            }
        }
Exemple #3
0
 //
 private void Start()
 {
     if (splash)
     {
         _splash = Instantiate(splash);
         _splash.transform.parent = GameManager._gameManager.SplashesAndBlows.transform;
         _splash.SetActive(false);
     }
     levl = FindObjectOfType <LevelGeneration>();
 }
Exemple #4
0
 //
 private void Awake()
 {
     if (MainGrenade)
     {
         Invoke("FireGrenade", 2);
         Invoke("D", 3);
     }
     if (!MainGrenade)
     {
         Invoke("D", 1);
     }
     levelGen = GameManager._gameManager.levelGeneration;
     coll     = GetComponent <CircleCollider2D>();
 }
Exemple #5
0
        /// <summary>
        /// Clears all temp map variables;
        /// </summary>
        public void ClearMap()
        {
            StopAllCoroutines();
            HealthScore[] _enemies = new HealthScore[0];
            _enemies = FindObjectsOfType <HealthScore>();
            if (_enemies.Length > 0)
            {
                foreach (var enemy in _enemies)
                {
                    DestroyImmediate(enemy.gameObject);
                }
            }
            _enemies = new HealthScore[0];
            GameObject obj1 = GameObject.Find("LevelParent");
            GameObject obj2 = GameObject.Find("Spawned Objects");

            if (obj1)
            {
                DestroyImmediate(obj1);
            }
            if (obj2)
            {
                DestroyImmediate(obj2);
            }
            LevelGeneration _levelGenerator = FindObjectOfType <LevelGeneration>();

            _levelGenerator.groundMap.ClearAllTiles();
            _levelGenerator.wallsMap.ClearAllTiles();
            // if (_levelGenerator.curentMap)
            //{
            if (_levelGenerator.MapProperties.extraSurface.Count != 0)
            {
                _levelGenerator.ClearSurfaces();
            }
            _levelGenerator.ClearValues();
            // }
        }