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");
    }
Пример #2
0
    public void applySceneChangeTitle()
    {
        Debug.Log("MessageBroker.Default.Publish<SceneChangeSingle>()");
        Time.timeScale = 0f;

        MessageBroker.Default.Publish <SceneChangeSimple>(new SceneChangeSimple {
            add_scene = "Title",
            del_scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name,

            pre_action = () => {
                // GUI表示をタイトル画面に切り替え
                GuiService.modeChange(GuiState.Title);

                // 設定画面表示を消去
                toggle_settings_dialog();

                // NextRoomを消去
                EffectService.nextRoomClear();

                // 地面に落ちてる装備品を削除
                EquipService.ClearTarget();
                EquipService.destroyEquipItem();

                // 装備品リストをクリア
                EquipService.clear();

                // 家具配置範囲再初期化
                EffectiveFloorService.reset();

                // 家具再初期化
                FieldObjectService.clear();

                // 敵削除
                EnemyService.destroyEnemyDead();
                EnemyService.destroyEnemy();
                EnemyService.stopSpawn();
            },

            post_action = () => {
                Time.timeScale = 1f;
            }
        });
    }
    public void OnDead()
    {
        state             = State.Dead;
        character_control = false;
        nmAgent.ResetPath();

        var voice_name_dead = SeService.getPlayerDeadVoice();

        MessageBroker.Default.Publish <PlaySe>(new PlaySe {
            name = voice_name_dead
        });

        transform.tag = "PlayerDead";
        //animator.radioBool("Die");
        MessageBroker.Default.Publish <PlayerDead>(new PlayerDead {
        });
        //Debug.Log("Publish: PlayerDead");

        PlayerService.game_over();
        EffectService.nextRoomOff();
    }
Пример #4
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
            });
        }
    }
Пример #5
0
 public void OnMiss()
 {
     EffectService.miss(gameObject.transform.position);
     //Debug.Log("EnemyController: OnMiss()");
 }
 public void OnLvUP()
 {
     MessageBroker.Default.Publish <SaveDataSave>(new SaveDataSave());
     EffectService.lvup(gameObject.transform.position);
     //Debug.Log("EnemyController: OnMiss()");
 }