private BlockDifficulty DeterminePowerUpBlock(Upgrades _upgradeType)
    {
        BlockDifficulty blockDifficulty = BlockDifficulty.None;

        switch (_upgradeType)
        {
        case Upgrades.ChargeUpgrade:
            blockDifficulty = BlockDifficulty.Charge;
            break;

        case Upgrades.ShieldUpgrade:
            blockDifficulty = BlockDifficulty.Shield;
            break;

        case Upgrades.MegaCoinUpgrade:
            blockDifficulty = BlockDifficulty.MegaCoin;
            break;

        default:
            blockDifficulty = BlockDifficulty.Shield;
            break;
        }

        return(blockDifficulty);
    }
Example #2
0
    public bool CreateBlockByDifficulty(BlockDifficulty blockType, int n_floor)
    {
        if (blockType == BlockDifficulty.SuperEasy)
        {
            game_controller.s.create_wave_super_easy(n_floor);
        }
        else if (blockType == BlockDifficulty.Easy)
        {
            game_controller.s.create_wave_easy(n_floor);
        }
        else if (blockType == BlockDifficulty.Medium)
        {
            game_controller.s.create_wave_medium(n_floor);
        }
        else if (blockType == BlockDifficulty.Hard)
        {
            game_controller.s.create_wave_hard(n_floor);
        }
        else if (blockType == BlockDifficulty.VeryHard)
        {
            game_controller.s.create_wave_very_hard(n_floor);
        }
        else
        {
            game_controller.s.create_wave_super_hard(n_floor);
        }

        return(true);
    }
    public void AddBlockToList(BlockDifficulty _blockDifficulty, LevelBlock _levelBlock)
    {
        switch (_blockDifficulty)
        {
        case BlockDifficulty.None:
            EmptyBlocks.Add(_levelBlock);
            break;

        case BlockDifficulty.Easy:
            EasyBlocks.Add(_levelBlock);
            break;

        case BlockDifficulty.Medium:
            MediumBlocks.Add(_levelBlock);
            break;

        case BlockDifficulty.Hard:
            HardBlocks.Add(_levelBlock);
            break;

        case BlockDifficulty.Shield:
            ShieldBlocks.Add(_levelBlock);
            break;

        case BlockDifficulty.MegaCoin:
            MegaCoinBlocks.Add(_levelBlock);
            break;

        case BlockDifficulty.Charge:
            UnlimitedChargeBlocks.Add(_levelBlock);
            break;

        case BlockDifficulty.Stamina:
            StaminaBlocks.Add(_levelBlock);
            break;

        case BlockDifficulty.Tutorial:
            TutorialBlocks.Add(_levelBlock);
            break;

        default:
            Debug.LogError("Unknown Block Difficulty");
            break;
        }
    }
    public LevelBlock GetPowerUpBlock(List <Upgrades> _avaliableUpgrades)
    {
        LevelBlock _newBlock = null;

        int _randomUpgradeIndex = Random.Range(0, _avaliableUpgrades.Count);

        Upgrades _currentUpgrade = _avaliableUpgrades[_randomUpgradeIndex];

        BlockDifficulty blockDifficulty = DeterminePowerUpBlock(_currentUpgrade);

        int _randomBlockIndex = 0;

        switch (blockDifficulty)
        {
        case BlockDifficulty.Shield:
            _randomBlockIndex = Random.Range(0, ShieldBlocks.Count);
            _newBlock         = ShieldBlocks[_randomBlockIndex];
            ShieldBlocks.Remove(_newBlock);
            break;

        case BlockDifficulty.MegaCoin:
            _randomBlockIndex = Random.Range(0, MegaCoinBlocks.Count);
            _newBlock         = MegaCoinBlocks[_randomBlockIndex];
            MegaCoinBlocks.Remove(_newBlock);
            break;

        case BlockDifficulty.Charge:
            _randomBlockIndex = Random.Range(0, UnlimitedChargeBlocks.Count);
            _newBlock         = UnlimitedChargeBlocks[_randomBlockIndex];
            UnlimitedChargeBlocks.Remove(_newBlock);
            break;

        default:
            _randomBlockIndex = Random.Range(0, ShieldBlocks.Count);
            _newBlock         = ShieldBlocks[_randomBlockIndex];
            ShieldBlocks.Remove(_newBlock);
            break;
        }

        return(_newBlock);
    }
    public LevelBlock GetLevelBlock(BlockDifficulty _blockDifficulty)
    {
        LevelBlock _newBlock    = null;
        int        _randomIndex = 0;

        switch (_blockDifficulty)
        {
        case BlockDifficulty.None:
            _randomIndex = Random.Range(0, EmptyBlocks.Count);
            _newBlock    = EmptyBlocks[_randomIndex];
            EmptyBlocks.Remove(_newBlock);
            break;

        case BlockDifficulty.Easy:
            _randomIndex = Random.Range(0, EasyBlocks.Count);
            _newBlock    = EasyBlocks[_randomIndex];
            EasyBlocks.Remove(_newBlock);
            break;

        case BlockDifficulty.Medium:
            _randomIndex = Random.Range(0, MediumBlocks.Count);
            _newBlock    = MediumBlocks[_randomIndex];
            MediumBlocks.Remove(_newBlock);
            break;

        case BlockDifficulty.Hard:
            _randomIndex = Random.Range(0, HardBlocks.Count);
            _newBlock    = HardBlocks[_randomIndex];
            HardBlocks.Remove(_newBlock);
            break;

        case BlockDifficulty.Shield:
            _randomIndex = Random.Range(0, ShieldBlocks.Count);
            _newBlock    = ShieldBlocks[_randomIndex];
            ShieldBlocks.Remove(_newBlock);
            break;

        case BlockDifficulty.MegaCoin:
            _randomIndex = Random.Range(0, MegaCoinBlocks.Count);
            _newBlock    = MegaCoinBlocks[_randomIndex];
            MegaCoinBlocks.Remove(_newBlock);
            break;

        case BlockDifficulty.Charge:
            _randomIndex = Random.Range(0, UnlimitedChargeBlocks.Count);
            _newBlock    = UnlimitedChargeBlocks[_randomIndex];
            UnlimitedChargeBlocks.Remove(_newBlock);
            break;

        case BlockDifficulty.Stamina:
            _randomIndex = Random.Range(0, StaminaBlocks.Count);
            _newBlock    = StaminaBlocks[_randomIndex];
            StaminaBlocks.Remove(_newBlock);
            break;

        case BlockDifficulty.Tutorial:
            _newBlock = TutorialBlocks[0];
            TutorialBlocks.RemoveAt(0);
            break;

        default:
            _randomIndex = Random.Range(0, EmptyBlocks.Count);
            _newBlock    = EmptyBlocks[_randomIndex];
            EmptyBlocks.Remove(_newBlock);
            Debug.LogError("Unknown Block Difficulty");
            break;
        }

        return(_newBlock);
    }