Ejemplo n.º 1
0
 public void UpdateText()
 {
     healthText.text = currentHitPoints.ToString();
     levelText.text  = active.GetLevel().ToString();
     if (expText != null)
     {
         expText.text = active.GetExpToNextLevel().ToString();
     }
 }
Ejemplo n.º 2
0
    private void AttackTarget(ActivePokemon attacker, ActivePokemon target)
    {
        UniquePokemon pokemonAttacker    = attacker.GetActive();
        UniquePokemon pokemonTarget      = target.GetActive();
        int           attackerLevel      = pokemonAttacker.GetLevel();
        int           attackerAttackStat = pokemonAttacker.GetAttack();
        int           targetDefenceStat  = pokemonTarget.GetDefence();

        int damage = CalculateDamage(attackerLevel, attackerAttackStat, targetDefenceStat);

        target.TakeDamage(damage);
        if (target.GetCurrentHitPoints() == 0)
        {
            target.Faint();
            if (attacker.IsPlayer())
            {
                pokemonAttacker.GainExp(pokemonTarget.CalculateExperienceReward());
                attacker.UpdateText();
            }
        }
    }