public void OnDamage(int enemy_atk)
    {
        var damage = PlayerService.getDamage(enemy_atk);

        //Debug.Log("EnemyController: OnDamage: damage: " + damage);

        EffectService.damage(damage, transform.position);

        // ダメージがゼロならエフェクト発生のみで終了
        if (damage == 0)
        {
            return;
        }

        // ダメージあればHP減少処理
        var remain = PlayerService.OnDamage(damage);

        //Debug.Log("EnemyController: OnDamage: hp_dead_line: " + hp_dead_line);
        //Debug.Log("EnemyController: OnDamage: remain: " + remain);

        if (remain <= hp_dead_line)
        {
            OnDead();
            //Debug.Log("PlayerController::OnDamage : state : " + state.ToString());
            return;
        }

        var voice_name_damage = SeService.getPlayerDamageVoice();

        //MessageBroker.Default.Publish<PlaySe>(new PlaySe{ name = voice_name_damage });
        PlaySE(voice_name_damage);

        //animator.radioBool("Damage");
        AnimationChange("Damage");
    }
Esempio n. 2
0
    public void OnDamage(int player_atk)
    {
        int damage = EnemyService.getDamage(player_atk, entity.def);

        EffectService.damage(damage, transform.position);

        entity.hp -= damage;
        //Debug.Log("EnemyController: OnDamage: damage: " + damage);

        if (entity.hp < hp_dead_line)
        {
            DoDeadMove();
            return;
        }

        if (animator)
        {
            animator.SetTrigger("Damage");
            MessageBroker.Default.Publish <PlaySe>(new PlaySe {
                name = entity.damage_voice
            });
        }
    }