Exemplo n.º 1
0
    IEnumerator SpawnBushesNow()
    {
        //foreach (SpawnAreaBush area in spawnAreas)
        //{

        Vector3 startingPos = spawnAreas[0].spawnLocation.position;
        for (int u = 0; u < spawnAreas.Count; u++)
        { 
            for (int i = 0; i < spawnAreas[u].row*2; i+=2)
            {
                for (int j = 0; j < spawnAreas[u].col*2; j+=2)
                {
                    int r = UnityEngine.Random.Range(1, 4);
                    switch (r)
                    {
                        case 1: spawnAreas[u].typeOfStatDrop = TypeOfStatIncrease.HP; break;
                        case 2: spawnAreas[u].typeOfStatDrop = TypeOfStatIncrease.ATK; break;
                        case 3: spawnAreas[u].typeOfStatDrop = TypeOfStatIncrease.DEF; break;
                        default: spawnAreas[u].typeOfStatDrop = TypeOfStatIncrease.HP; break;
                    }

                    float y = spawnAreas[u].spawnLocation.position.y;
                    //ScaleToYaxis(y, spawnAreas[u]);

                    SpawnAreaBush tempBush = new SpawnAreaBush();
                    if (y < 20f)
                        tempBush = ScaleEnemyToWeaponType(1, spawnAreas[u]);
                    else if (y > 20f && y < 80f) // moderate
                        tempBush = ScaleEnemyToWeaponType(1.25f, spawnAreas[u]);
                    else if (y > 80f && y < 170f) // hard
                        tempBush = ScaleEnemyToWeaponType(1.75f, spawnAreas[u]);
                    else if (y > 170f)
                        tempBush = ScaleEnemyToWeaponType(2.5f, spawnAreas[u]);                                        

                    SpawnResultBush result = new SpawnResultBush();
                    Vector3 tempPos = startingPos + new Vector3(i, j, 0f);

                    var bush = CreateBush(spawnAreas[u].prefab, tempPos,
                        HP_Median, Atk_Median, Def_Median,
                        tempBush.amountOfStatToGive, spawnAreas[u].typeOfStatDrop);

                    if (firstBush)
                        firstBush = false;
                    
                    spawnAreas[u].spawnLocation.position = tempPos;
                    bush.Spawner = this;
                    result.enemy = bush;  
                    result.source = spawnAreas[u];   // reference this area values for respawning                    
                    spawnResults.Add(result); // add enemy to the list of spawned enemies
                }
            }
            yield return null;
        }
    }
Exemplo n.º 2
0
    IEnumerator SpawnBushesNow()
    {
        foreach (SpawnAreaBush area in spawnAreas)
        {
            for (int i = 0; i < area.row*2; i+=2)
            {
                for (int j = 0; j < area.col*2; j+=2)
                {
                    int r = UnityEngine.Random.Range(1, 4);
                    switch (r)
                    {
                        case 1: area.typeOfStatDrop = TypeOfStatIncrease.HP; break;
                        case 2: area.typeOfStatDrop = TypeOfStatIncrease.ATK; break;
                        case 3: area.typeOfStatDrop = TypeOfStatIncrease.DEF; break;
                        default: area.typeOfStatDrop = TypeOfStatIncrease.HP; break;
                    }

                    float y = area.spawnLocation.position.y;
                    ScaleToYaxis(y, area);

                    SpawnAreaBush tempBush = new SpawnAreaBush();
                    if (y < 20f)
                        tempBush = ScaleEnemyToWeaponType(1, area);
                    else if (y > 20f && y < 80f) // moderate
                        tempBush = ScaleEnemyToWeaponType(2, area);
                    else if (y > 80f && y < 170f) // hard
                        tempBush = ScaleEnemyToWeaponType(3, area);
                    else if (y > 170f)
                        tempBush = ScaleEnemyToWeaponType(4, area);                                        

                    SpawnResultBush result = new SpawnResultBush();
                    Vector3 tempPos = area.spawnLocation.position + new Vector3(i, j, 0f);

                    var bush = CreateBush(area.prefab, tempPos,
                        HP_Median, Atk_Median, Def_Median,
                        tempBush.amountOfStatToGive, area.typeOfStatDrop);

                    if (firstBush)
                        firstBush = false;

                    //SpawnAreaBush sab = new SpawnAreaBush();
                    //sab = area;
                    //sab.spawnLocation.position = tempPos;

                    bush.Spawner = this;
                    result.enemy = bush;  
                    result.source = area;   // reference this area values for respawning                    
                    spawnResults.Add(result); // add enemy to the list of spawned enemies
                }
            }
            yield return null;
        }
    }
Exemplo n.º 3
0
 public void ScaleToYaxis(float y, SpawnAreaBush area)
 {
     if (y < 20f) // easy
         ScaleEnemyToWeaponType(1, area);
     else if (y > 20f && y < 80f) // moderate
         ScaleEnemyToWeaponType(2, area);
     else if (y > 80f && y < 170f) // hard
         ScaleEnemyToWeaponType(4, area);
     else if (y > 170f)
         ScaleEnemyToWeaponType(5, area);
 }
Exemplo n.º 4
0
    // The weapon type sets the base then the scale is based on the y cooridinate (south to north, easy to harder)
    public SpawnAreaBush ScaleEnemyToWeaponType(float scale, SpawnAreaBush area)
    {        
        if (playerCurrentWeapon != null)
        {
            SpawnAreaBush tempArea = area;
            switch (playerCurrentWeapon.weaponType)
            {
                case WeaponType.Wooden:
                    HP_Median = 1f;
                    Atk_Median = 10f;
                    Def_Median = 0f;
                    switch (area.typeOfStatDrop)
                    {
                        case TypeOfStatIncrease.ATK: tempArea.amountOfStatToGive = 0.5f; return tempArea; 
                        case TypeOfStatIncrease.DEF: tempArea.amountOfStatToGive = 0.001f; return tempArea;
                        case TypeOfStatIncrease.HP: tempArea.amountOfStatToGive = 1; return tempArea;
                    }
                    break;
                case WeaponType.Bronze:
                    HP_Median = 1f;
                    Atk_Median = 10f;
                    Def_Median = 0f;
                    switch (area.typeOfStatDrop)
                    {
                        case TypeOfStatIncrease.ATK: tempArea.amountOfStatToGive = 1f * (scale - (scale / 3)); return tempArea;
                        case TypeOfStatIncrease.DEF: tempArea.amountOfStatToGive = 0.0015f; return tempArea;
                        case TypeOfStatIncrease.HP: tempArea.amountOfStatToGive = 10 * (scale - (scale / 3)); return tempArea;
                    }
                    break;
                case WeaponType.Silver:
                case WeaponType.Gold:
                case WeaponType.Epic:
                    HP_Median = 1f;
                    Atk_Median = 10f;
                    Def_Median = 0f;
                    switch (area.typeOfStatDrop)
                    {
                        case TypeOfStatIncrease.ATK: tempArea.amountOfStatToGive = 50f * (scale - (scale / 3)); return tempArea;
                        case TypeOfStatIncrease.DEF: tempArea.amountOfStatToGive = 0.002f; return tempArea;
                        case TypeOfStatIncrease.HP: tempArea.amountOfStatToGive = 500f * (scale - (scale / 3)); return tempArea;
                    }
                    break;

            }
        }
        return null;
    }