// Use this for initialization void Start() { _HpState = HP_State.Fine; _NowState = State.Default; //キャラリスト読み込み charaList = Resources.Load("Data/CharaList") as Entity_CharaList; //キャラ成長率リスト読み込み chara_rateList = Resources.Load("Data/Chara_rateList") as Entity_Chara_rateList; //クラスリスト読み込み classList = Resources.Load("Data/ClassList") as Entity_ClassList; //武器リストを読み込み weaponList = Resources.Load("Data/WeaponList") as Entity_WeaponList; //自分の子にあるアイテムリストを取得 _itemprefablist = GameObject.Find(transform.name + "/ItemList"); //自分の子にあるスキルリストを取得 _skillprefablist = GameObject.Find(transform.name + "/SkillList"); _skillchecker = GetComponent <SkillChecker>(); //キャラの初期化 if (!_reset) { for (var i = 0; i < charaList.param.Count; i++) { if (charaList.param[i].name == _name) { //idの上書き _id = i; //各能力値と成長率の読み込み _level = charaList.param[_id].lv; _totalLevel = _level; _hp = charaList.param[_id].hp; _hprate = chara_rateList.param[_id].hp; _str = charaList.param[_id].str; _strrate = chara_rateList.param[_id].str; _skl = charaList.param[_id].skl; _sklrate = chara_rateList.param[_id].skl; _spd = charaList.param[_id].spd; _spdrate = chara_rateList.param[_id].spd; _luk = charaList.param[_id].luk; _lukrate = chara_rateList.param[_id].luk; _def = charaList.param[_id].def; _defrate = chara_rateList.param[_id].def; _cur = charaList.param[_id].cur; _currate = chara_rateList.param[_id].cur; _move = charaList.param[_id].move; _moverate = chara_rateList.param[_id].move; //クラス(職業)の読み込み _class = charaList.param[_id].job; } } _reset = true; } ClassChange(_class); TotalStatus(); FullRecoveryHP(); }
// Update is called once per frame void Update() { //HPの状態による分岐 switch (_HpState) { //HP100~80% case HP_State.Fine: if (_totalhp <= _totalMaxhp * 0.8) { _HpState = HP_State.Bleeding; } break; //HP80~50% case HP_State.Bleeding: if (_totalhp <= _totalMaxhp * 0.5) { _HpState = HP_State.Severe; } break; //HP50~20% case HP_State.Severe: if (_totalhp <= _totalMaxhp * 0.2) { _HpState = HP_State.Dying; } break; //HP20~0% case HP_State.Dying: if (_totalhp <= 0) { _HpState = HP_State.Dead; } break; //死 case HP_State.Dead: _totalhp = 0; Dead(); break; } //exp100でレベルアップ if (_exp >= 100) { LevelUp(); } //AddStatus(); TotalStatus(); }