Ejemplo n.º 1
0
 void Start()
 {
     pokemon = GetComponent <UniquePokemon>();
     if (pokemon.GetPokemon() != null)
     {
         sprite.sprite = pokemon.GetPokemon().GetIcon();
     }
 }
Ejemplo n.º 2
0
 private void GetNewActive()
 {
     // Called in animator
     active           = currentRoute.GetSpawn();
     currentHitPoints = active.GetHitPoints();
     UpdateText();
     sprite.sprite = active.GetPokemon().GetSpriteFront();
     anim.SetBool("Fainted", false);
 }
Ejemplo n.º 3
0
    void Start()
    {
        if (player)
        {
            active        = team.GetPokemon(0);
            sprite.sprite = active.GetPokemon().GetSpriteBack();
        }
        else
        {
            GetNewActive();
            sprite.sprite = active.GetPokemon().GetSpriteFront();
        }

        currentHitPoints = active.GetHitPoints();
        UpdateText();
    }
Ejemplo n.º 4
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();
            }
        }
    }