Beispiel #1
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;
            }
        });
    }
Beispiel #2
0
    void Start()
    {
        EnemyService.startSpawn();
        MessageBroker.Default.Publish <EnemySpawnStart>(new EnemySpawnStart());

/*
 *      EnemyFactory.init(prefabs);
 *
 *      Observable.Zip(
 *          MessageBroker.Default.Receive<CreatedGameStageRank>(),
 *          MessageBroker.Default.Receive<CreatedEquipBaseResouces>(),
 *          MessageBroker.Default.Receive<LogInitialized>(),
 *          Tuple.Create
 *      ).Subscribe(x => {
 *          LogService.write("EnemyManager::Awake()::Receive<3>");
 *          EnemyService.startSpawn();
 *
 *          MessageBroker.Default.Publish<EnemySpawnStart>(new EnemySpawnStart());
 *      });
 */
    }
Beispiel #3
0
    void Start()
    {
        player_detect_speed = EnemyService.get_detect_interval(entity.rank);
        nmSurface           = GameObject.FindGameObjectWithTag("SystemManager").GetComponent <NavMeshSurface>();
        nmAgent             = GetComponent <NavMeshAgent>();
        animator            = GetComponent <Animator>();
        outline             = GetComponentInChildren <Outline>();
        collider            = GetComponent <Collider>();

        Observable.Interval(TimeSpan.FromMilliseconds(player_detect_speed)).Subscribe(x => {
            // プレイヤー位置を取得する
            player_position = PlayerService.position();
        }).AddTo(this);

        character_control = true;
        DoMoveMode();

        //Debug.Log("EnemyController : id : " + id);
        //Debug.Log("EnemyController : entity.name : " + entity.name);

        //this.UpdateAsObservable().ObserveOnMainThread().Subscribe(x => {
        //});
    }
Beispiel #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
            });
        }
    }