Darkfafi / Mythe_Orion_Game

Game for mobile school project Mythe Orion
1 stars 0 forks source link

Scheiden van proces #17

Open RichardRam87 opened 9 years ago

RichardRam87 commented 9 years ago
public override void GetDamage (int dmg)
    {
        int blockChance = 0;

        if (_currentWeapon.GetComponent<MeleeWeapon>() != null) {
            blockChance =  Mathf.RoundToInt(Random.Range (0, 100));
            if(blockChance < _chanceToBlockPercentage){
                blockChance = 1;
            }else{
                blockChance = 0;
            }
        }
        if(blockChance == 0){
            base.GetDamage (dmg);
        }else{
            //block animation.
        }
    } 

Bestand: https://github.com/Darkfafi/Mythe_Orion_Game/blob/master/Assets/_Scripts/Actors/Player/Player.cs

Ik zou hier de verantwoordelijkheden van deze functie scheiden of de naam v/d functie veranderen. Het berekenen v/d blockchange is iets anders dan het verwerken van dmg.