Exemplo n.º 1
0
    public void PlayerAttack(int loss)
    {
        int evasionNum   = Random.Range(0, 100);
        int justGuardNum = Random.Range(0, 100);

        if (loss < 0)
        {
            loss = 1;
        }
        StartCoroutine(DamageNum(loss));
        if (gameObject.CompareTag("Enemy"))
        {
            if (evasionNum > (int)(enemyStatus.evasion / 100) || justGuardNum > enemyStatus.justGuard * 100)
            {
                enemyStatus.hp -= loss;
            }
            else
            {
                loss            = 0;
                enemyStatus.hp -= loss;
            }

            if (enemyStatus.hp <= 0)
            {
                PlayerStatus.instance.LevelUp(enemyStatus.experience);
                Invoke("Death", 0.5f);
                enemyDropItem.DropIfNeeded(ItemDropPosition());
            }
        }
    }
Exemplo n.º 2
0
    public void PlayerAttackToBoss(int loss)
    {
        if (loss < 0)
        {
            loss = 1;
        }
        StartCoroutine(DamageNum(loss));
        if (gameObject.CompareTag("Enemy"))
        {
            enemyStatus.hp -= loss;

            if (enemyStatus.hp <= 0)
            {
                PlayerStatus.instance.LevelUp(enemyStatus.experience);
                Invoke("Death", 0.5f);
                enemyDropItem.DropIfNeeded(ItemDropPosition());
            }
        }
    }