示例#1
0
    private void StartRound()
    {
        Enemy prefab = DataMap.GetEnemyDatasBossPrefab().GetEnemy;

        if (prefab == null)
        {
            Debug.Log("Null a");
            EndRound();
            return;
        }
        CloseAllDoor();
        List <Vector2> listposspawn = new List <Vector2>();

        for (int i = 0; i < Data.AmountBoss; i++)
        {
            listposspawn.Add(Vector2.zero);
        }
        switch (Data.AmountBoss)
        {
        case 1:
            listposspawn[0] = Data.position;
            break;

        case 2:
            listposspawn[0] = Data.position + new Vector2(-Data.Size.x / 4, 0);
            listposspawn[1] = Data.position + new Vector2(Data.Size.x / 4, 0);
            break;

        case 3:
            listposspawn[0] = Data.position + new Vector2(-Data.Size.x / 4, 0);
            listposspawn[1] = Data.position + new Vector2(Data.Size.x / 4, 0);
            listposspawn[2] = Data.position + new Vector2(0, Data.Size.y / 4);
            break;

        case 4:
            listposspawn[2] = Data.position + new Vector2(0, Data.Size.y / 4);
            listposspawn[0] = Data.position + new Vector2(-Data.Size.x / 4, 0);
            listposspawn[1] = Data.position + new Vector2(Data.Size.x / 4, 0);
            listposspawn[3] = Data.position + new Vector2(0, -Data.Size.y / 4);
            break;
        }
        for (int i = 0; i < Data.AmountBoss; i++)
        {
            Enemy enemy = EntityManager.Instance.SpawnEnemy(prefab, listposspawn[i], transform);
            HasMoreEnemy(enemy);
        }
    }