/// <summary> /// データを読み込んでbuilderとしてListに組み込みます /// </summary> void loadBuilder() { var max = MaxId; for (int i = 0; i < max; i++) { ShootWeaponBuilder builder = new ShootWeaponBuilder(); //各値を読み込み builder.Id = int.Parse(getRawParam(i, "ID")); builder.Name = getRawParam(i, "Name"); builder.Ammo = int.Parse(getRawParam(i, "Ammo")); builder.Damage = float.Parse(getRawParam(i, "Damage")); builder.FireRate = float.Parse(getRawParam(i, "FireRate")); builder.NeedStr = int.Parse(getRawParam(i, "NeedSTR")); builder.Range = float.Parse(getRawParam(i, "Range")); builder.Recoil = float.Parse(getRawParam(i, "Recoil")); builder.Weight = float.Parse(getRawParam(i, "Weight")); builder.ZoomRate = float.Parse(getRawParam(i, "ZoomRate")); builder.IsAutomatic = (getRawParam(i, "isAutomatic") == "TRUE"); builder.ReloadSec = float.Parse(getRawParam(i, "ReloadSec")); builder.WeaponPrefab = (GameObject)Resources.Load("Prefabs/" + getRawParam(i, "ObjectName")); builder.WeaponAnim = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Animators/" + getRawParam(i, "AnimName"))); builders.Add(builder); } }
/// <summary> /// コンストラクタ /// ビルダーを用いて初期化 /// </summary> /// <param name="builder">データが入力されたビルダー</param> public ShootWeapon(ShootWeaponBuilder builder) { id = builder.Id; name = builder.Name; recoil = builder.Recoil; range = builder.Range; damage = builder.Damage; ammo = builder.Ammo; zoomRate = builder.ZoomRate; needStr = builder.NeedStr; weight = builder.Weight; fireSec = builder.FireRate; reloadSec = builder.ReloadSec; isAutomatic = builder.IsAutomatic; weaponPrefab = builder.WeaponPrefab; weaponAnim = builder.WeaponAnim; //ユニークIDを取得:getterに更新作業が含まれている uniqueId = WeaponHelper.NewestId; }