Ejemplo n.º 1
0
    public override void ApplyToMap(Vector3Int position)
    {
        int w = 30;
        int h = 30;

        MapBuilder.GenerateRandomWalkersMapFloor(w, h, pathSize: 3, walkerCount: 8, steps: 40, minBeforeTurn: 5, maxBeforeTurn: 8);

        // We need collision map to select a player position so build it now
        MapBuilder.BuildCollisionMapFromMapSource();
        playerStartPos_ = MapUtil.GetRandomEdgePosition(out Vector3 unused);

        List <(Vector3, float)> forbiddenPositions = new List <(Vector3, float)>();

        forbiddenPositions.Add((playerStartPos_, 10));

        var dynamicObjects = GameObject.FindWithTag("DynamicObjects");
        int difficulty     = CurrentRunData.Instance.StartingDifficulty + CurrentRunData.Instance.TotalFloor;
        List <EnemySpawnDefinition> enemySpawnDefinitions = new List <EnemySpawnDefinition>();

        if (difficulty < 12)
        {
            DebugLinesScript.Show("Unexpected difficulty for World3 (expected >= 12)", difficulty);
        }

        difficulty -= 11;
        difficulty  = 1;
        int minotaurCount = difficulty / 2;
        int elfCount      = difficulty + 1;
        int ravenCount    = Random.Range(0, (difficulty / 2) + 3) + 1;

        enemySpawnDefinitions.Add(new EnemySpawnDefinition()
        {
            EnemyId = EnemyId.Raven, Count = ravenCount
        });
        enemySpawnDefinitions.Add(new EnemySpawnDefinition()
        {
            EnemyId = EnemyId.Elf, Count = elfCount
        });
        enemySpawnDefinitions.Add(new EnemySpawnDefinition()
        {
            EnemyId = EnemyId.Minotaur, Count = minotaurCount
        });

        EnemySpawner.Instance.AddEnemiesForWorld(enemySpawnDefinitions, dynamicObjects.transform, forbiddenPositions);
    }
Ejemplo n.º 2
0
    public override void ApplyToMap(Vector3Int position)
    {
        int w = 40;
        int h = 40;

        MapBuilder.GenerateMapFloor(w, h, MapFloorAlgorithm.RandomWalkers);

        // We need collision map to select a player position so build it now
        MapBuilder.BuildCollisionMapFromMapSource();
        playerStartPos_ = MapUtil.GetRandomEdgePosition(out Vector3 unused);

        List <(Vector3, float)> forbiddenPositions = new List <(Vector3, float)>();

        forbiddenPositions.Add((playerStartPos_, 10));

        var dynamicObjects = GameObject.FindWithTag("DynamicObjects");
        int difficulty     = CurrentRunData.Instance.StartingDifficulty + CurrentRunData.Instance.TotalFloor;
        List <EnemySpawnDefinition> enemySpawnDefinitions = new List <EnemySpawnDefinition>();

        bool isFirstLevel = difficulty == 1;

        int batCount     = 2 + difficulty / 2;
        int fireBatCount = difficulty + 1;
        int scytheCount  = isFirstLevel ? 0 : Random.Range(0, (difficulty / 2) + 2);
        int golemCount   = (difficulty & 1) == 1 ? 0 : 1 + difficulty / 6;

        enemySpawnDefinitions.Add(new EnemySpawnDefinition()
        {
            EnemyId = EnemyId.SeekerScythe, Count = scytheCount
        });
        enemySpawnDefinitions.Add(new EnemySpawnDefinition()
        {
            EnemyId = EnemyId.Bat, Count = batCount
        });
        enemySpawnDefinitions.Add(new EnemySpawnDefinition()
        {
            EnemyId = EnemyId.FireBat, Count = fireBatCount
        });
        enemySpawnDefinitions.Add(new EnemySpawnDefinition()
        {
            EnemyId = EnemyId.Golem, Count = golemCount
        });

        EnemySpawner.Instance.AddEnemiesForWorld(enemySpawnDefinitions, dynamicObjects.transform, forbiddenPositions);
    }