Example #1
0
        public static GameObject createGameObject(EquipEntity entity, Vector3 position)
        {
            Debug.Log("Item.Equip.Factory.createGameObject() : entity.prefab_id : " + entity.prefab_id.ToString());
            Debug.Log("Item.Equip.Factory.createGameObject() : _prefabs.Count : " + _prefabs.Count.ToString());

            var go_base = _prefabs[entity.prefab_id];
            var go      = Object.Instantiate(go_base);

            ItemEquipController iec = go.GetComponentInChildren <ItemEquipController>();

            if (iec != null)
            {
                iec.entity = entity;
            }

            // 出現位置の設定
            go.transform.position = position;
            EquipService.set(go);

            return(go);
        }
        public static IEnumerator in_fade(int add_clear_count, int add_strength, int add_num)
        {
            // 操作があるまで待つ
            while (!Input.GetMouseButtonUp(0) && !Input.GetKeyUp(KeyCode.Space) && !Input.GetKeyUp(KeyCode.Return))
            {
                yield return(null);
            }

            // 画面をフルフェード
            yield return(GuiService.fadeBacground(1f));

            Time.timeScale = 1f;

            // プレイヤー再初期化
            PlayerService.reset();
            yield return(new WaitForEndOfFrame());

            // BGMチェック
            MessageBroker.Default.Publish <BgmCheck>(new BgmCheck());
            yield return(null);

            // 次のステージ情報更新
            _room_clear_count += add_clear_count;
            if (_room_clear_count < 1)
            {
                _room_clear_count = 1;
            }

            _enemy_strength += add_strength;
            if (_enemy_strength < 1)
            {
                _enemy_strength = 1;
            }

            _enemy_num += add_num;
            if (_enemy_num < 1)
            {
                _enemy_num = 1;
            }

            // ドア閉める

            // NextRoomのエフェクトを消去
            EffectService.nextRoomOff();
            yield return(new WaitForEndOfFrame());

            // 地面に落ちてる装備品を削除
            ItemEquipService.ClearTarget();
            ItemEquipService.destroyEquipItem();
            yield return(new WaitForEndOfFrame());

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

            // 家具再初期化
            FieldObjectService.reset();
            yield return(new WaitForEndOfFrame());

            // 敵削除
            EnemyService.destroyEnemyDead();
            yield return(new WaitForEndOfFrame());

            // リセット後の状態を保存
            MessageBroker.Default.Publish <SaveDataSave>(new SaveDataSave());
            yield return(new WaitForEndOfFrame());

            Time.timeScale = 0f;
        }
Example #3
0
/*
        public static void backgroundFade(float rate, float time = 0.5f)
        {
            var image = fade_background.GetComponent<Image>();
            image.color = new Color(0, 0, 0, rate);
        }
*/


        public static void update()
        {
            if (_state != GuiState.Room) return;

            // *左上*
            // Lv表示
            string lv_str = PlayerService.statuString("Lv");
            ui_text["Lv"].text = lv_str;

            // 経験値バー
            int lv = PlayerService.status("Lv");
            int exp = PlayerService.now_exp();
            int next_level = PlayerService.next_exp();
            //Debug.Log("exp: " + exp.ToString());
            //Debug.Log("next_level: " + next_level.ToString());
            ui_bar["ExpBar"].value = exp;
            ui_bar["ExpBar"].maxValue = next_level;
            /*
            ui_bar["ExpBar"].value = PlayerService.status("Exp");
            ui_bar["ExpBar"].maxValue = PlayerService.nextLevel(lv);
            */

            // HP表示
            string hp_str = PlayerService.statuString("HP");
            string max_hp_str = PlayerService.statuString("MaxHP");
            ui_text["HP"].text = (hp_str + " / " + max_hp_str);

            // HPバー
            //int hp = PlayerService.status("HP");
            //int max_hp = PlayerService.status("MaxHP");
            ui_bar["HPBar"].value = PlayerService.status("HP");
            ui_bar["HPBar"].maxValue = PlayerService.status("MaxHP");

            // *右上*
            // クリアした部屋の数
            ui_text["RoomClear"].text = GameStageService.status("clear_count").ToString();
            // 敵の強さ
            ui_text["EnemyStrength"].text = GameStageService.status("enemy_strength").ToString();
            // 敵数
            ui_text["EnemyNum"].text = GameStageService.status("enemy_num").ToString();

            // *左下*
            int p_atk = PlayerService.status("Atk");
            int p_def = PlayerService.status("Def");
            int p_spd = PlayerService.status("Spd");
            ui_text["PlayerAtk"].text = p_atk.ToString();
            ui_text["PlayerDef"].text = p_def.ToString();
            ui_text["PlayerSpd"].text = p_spd.ToString();

            // *右下*
            int atk = EquipService.status("Atk");
            int def = EquipService.status("Def");
            int spd = EquipService.status("Spd");
            int atk_op = EquipService.status("AtkOp");
            int def_op = EquipService.status("DefOp");
            int spd_op = EquipService.status("SpdOp");

            ui_text["WeaponName"].text = EquipService.weapon_name();
            ui_text["WeaponAtkTotal"].text = (atk + atk_op).ToString();
            ui_text["WeaponDefTotal"].text = (def + def_op).ToString();
            ui_text["WeaponSpdTotal"].text = (spd + spd_op).ToString();
            ui_text["WeaponAtkBaseOp"].text = $"{atk} + {atk_op}";
            ui_text["WeaponDefBaseOp"].text = $"{def} + {def_op}";
            ui_text["WeaponSpdBaseOp"].text = $"{spd} + {spd_op}";
        }