Ejemplo n.º 1
0
    public void Attacked(float Attacked)
    {
        //float damage = Mathf.Max(Attacked - defense);
        BattleManagerScript battle_manager_script = GameObject.FindGameObjectWithTag("BattleManager").GetComponent <BattleManagerScript>();

        if (HP > 0)
        {
            Damage = Defense - Attacked;
            if (Damage < 0)
            {
                HP = HP + Damage;
            }
            if (HP < 0)
            {
                sliderHP.value = 0;
                battle_manager_script.Finish(player_die: true);
            }
        }
        else
        {
            sliderHP.value = 0;
            battle_manager_script.Finish(player_die: true);
        }
        sliderHP.value = HP / 100.0f;
    }
 public void Check()
 {
     if (FightEnemyCreate.fight_enemy_create.gameObject.transform.childCount - 1 == 0)
     {
         battleManagerScript.Finish(player_die: false);
     }
 }