Example #1
0
    private IEnumerator SpawnEnemy()
    {
        if (currentSpawnTime > spawnDelay)
        {
            currentSpawnTime = 0;

            if (EnemyList.Count < currentLevel)
            {
                Vector3    spawnPoint   = spawnPoints[Random.Range(0, spawnPoints.Length)].transform.position;
                GameObject enemyToSpawn = enemies[Random.Range(0, enemies.Length)];
                Instantiate(enemyToSpawn);
                enemyToSpawn.transform.position = spawnPoint;
            }
        }

        if (RoundKills == EnemyList.Count && EnemyList.Count > 0 && currentLevel != finalLevel)
        {
            EnemyList.Clear();
            RoundKills = 0;
            yield return(new WaitForSeconds(3f));

            currentLevel++;
            levelText.text = "Level " + currentLevel;
        }

        if (RoundKills == finalLevel)
        {
            StartCoroutine(EndGame("Victory!"));
        }

        yield return(null);

        StartCoroutine(SpawnEnemy());
    }
    public void ReloadLevel()
    {
        IsPaused    = true;
        isReloading = true;
        EnemyList.Clear();
        DeserializeLevelData();
        SetActiveFunction(doorList);
        SetParallax();

        /*finalGhostObjects = ghostObjects;
         * for (int i = 0; i < ghostObjects.Count; i++)
         *  Destroy(ghostObjects[i].gameObject);
         * ghostObjects.Clear();
         * if (isGhostReplayActive)
         * {
         *  if (!hasBeenInit)
         *  {
         *      hasBeenInit = true;
         *      InitialzeGhostPlayer();
         *      //player.GetComponent<PlayerController>().inputScript.Reset();
         *  }
         * }*/
        System.GC.Collect();
        System.GC.WaitForPendingFinalizers();
    }
Example #3
0
 public void Reset()
 {
     ItemList.Clear();
     EnemyList.Clear();
     BlockList.Clear();
     BackgroundList.Clear();
 }
 private void DestroyAllEnemies()
 {
     foreach (var enemy in enemyList)
     {
         Destroy(enemy.gameObject);
     }
     EnemyList.Clear();
 }
 /// <summary>
 /// グループ行動終了を知らせる
 /// </summary>
 /// <param name="enemyList"></param>
 public void NoticeEnemiesGroupEnd()
 {
     for (int i = 0; i < EnemyList.Count; i++)
     {
         if (EnemyList[i] != null)
         {
             EnemyList[i].GroupEnd();
         }
     }
     EnemyList.Clear();
 }
Example #6
0
 public override void Dispose()
 {
     if (!IsDisposed)
     {
         foreach (var current in DoorList)
         {
             current.Dispose();
         }
         DoorList.Clear();
         DoorList = null;
         foreach (var current2 in TerrainObjList)
         {
             current2.Dispose();
         }
         TerrainObjList.Clear();
         TerrainObjList = null;
         foreach (var current3 in GameObjList)
         {
             current3.Dispose();
         }
         GameObjList.Clear();
         GameObjList = null;
         foreach (var current4 in EnemyList)
         {
             current4.Dispose();
         }
         EnemyList.Clear();
         EnemyList = null;
         foreach (var current5 in BorderList)
         {
             current5.Dispose();
         }
         BorderList.Clear();
         BorderList = null;
         BGRender   = null;
         LinkedRoom = null;
         foreach (var current6 in TempEnemyList)
         {
             current6.Dispose();
         }
         TempEnemyList.Clear();
         TempEnemyList = null;
         Player        = null;
         m_fairyChestText.Dispose();
         m_fairyChestText = null;
         m_pauseBG.Dispose();
         m_pauseBG = null;
         m_indexText.Dispose();
         m_indexText = null;
         m_roomInfoText.Dispose();
         m_roomInfoText = null;
         base.Dispose();
     }
 }
 //Reset all the level variables.
 public void ClearLevel()
 {
     IsPaused = true;
     player   = null;
     doorList.Clear();
     doorList = null;
     serializedData.objectList.Clear();
     serializedData = null;
     _uniqueObjects = null;
     levelData.objectList.Clear();
     levelData = null;
     EnemyList.Clear();
 }
Example #8
0
    public void WipeAllEnemies()
    {
        Enemy[] array = EnemyList.ToArray();

        foreach (Enemy enemy in array)
        {
            if (enemy != null)
            {
                RemoveEnemy(enemy);
            }
        }

        EnemyList.Clear();
    }
Example #9
0
 /// <summary>
 /// 关闭
 /// </summary>
 public void Close()
 {
     EnemyList.Clear();
     gameObject.SetActive(false);
 }
Example #10
0
        public override void Initialize()
        {
            TerrainObj terrainObj  = null;
            TerrainObj terrainObj2 = null;
            TerrainObj terrainObj3 = null;
            TerrainObj terrainObj4 = null;

            foreach (var current in TerrainObjList)
            {
                if (current.Name == "BlacksmithBlock")
                {
                    terrainObj = current;
                }
                if (current.Name == "EnchantressBlock")
                {
                    terrainObj2 = current;
                }
                if (current.Name == "ArchitectBlock")
                {
                    terrainObj3 = current;
                }
                if (current.Name == "SignBlock")
                {
                    terrainObj4 = current;
                }
            }
            if (terrainObj != null)
            {
                TerrainObjList.Remove(terrainObj);
            }
            if (terrainObj2 != null)
            {
                TerrainObjList.Remove(terrainObj2);
            }
            if (terrainObj3 != null)
            {
                TerrainObjList.Remove(terrainObj3);
            }
            if (terrainObj4 != null)
            {
                TerrainObjList.Remove(terrainObj4);
            }
            if (m_tree1 == null)
            {
                foreach (var current2 in GameObjList)
                {
                    if (current2.Name == "Mountains 1")
                    {
                        m_mountain1 = (current2 as SpriteObj);
                    }
                    else if (current2.Name == "Mountains 2")
                    {
                        m_mountain2 = (current2 as SpriteObj);
                    }
                    else if (current2.Name == "Sign")
                    {
                        current2.Visible = false;
                    }
                    if (current2.Name == "Tree1")
                    {
                        m_tree1 = current2;
                    }
                    else if (current2.Name == "Tree2")
                    {
                        m_tree2 = current2;
                    }
                    else if (current2.Name == "Tree3")
                    {
                        m_tree3 = current2;
                    }
                    else if (current2.Name == "Fern1")
                    {
                        m_fern1 = current2;
                    }
                    else if (current2.Name == "Fern2")
                    {
                        m_fern2 = current2;
                    }
                    else if (current2.Name == "Fern3")
                    {
                        m_fern3 = current2;
                    }
                }
            }
            EnemyList.Clear();
            base.Initialize();
        }
 public void ResetCache()
 {
     EnemyList.Clear();
     LogList.Clear();
 }