private void OnTriggerExit(Collider other) { switch (other.tag) { case TagName.RECOVERY_POINT: nutrientsRecoveryPoint_ = null; break; } }
private void OnTriggerEnter(Collider other) { switch (other.tag) { case TagName.RECOVERY_POINT: // 補給所がnullじゃないなら処理する必要がない if (nutrientsRecoveryPoint_ != null) { break; } // 触れた補給所が使えなかったら処理する必要がない var nutrientsRecoveryPoint = other.GetComponent <NutrientsRecoveryPoint>(); if (!nutrientsRecoveryPoint.IsCharge) { break; } // 補給所獲得 nutrientsRecoveryPoint_ = nutrientsRecoveryPoint; break; } }
/// <summary> /// 弾の補充(野生のフルーツ) /// </summary> /// <param name="vitaminType">補充するビタミンの種類</param> /// <param name="value">補給量</param> void Reload(NutrientsRecoveryPoint vrp) { if (!Input.GetButtonDown(Constants.InputName.RELOAD)) { return; } if (IsDash) { return; } if (searchArea.IsSearch) { return; } if (IsSpecialWeapon) { return; } if (!nutrientsRecoveryPoint_) { return; } switch (vrp.VitaminType) { case NUTRIENTS_TYPE._A: { if (gunL_.Ammo == gunL_.MaxAmmo_) { return; } //gunL_.Reload(vrp.Charge(GunAmmoMAX_L - GunAmmoL)); Gun[] guns = new Gun[] { gunL_ }; vrp.Charge(guns); _audioManager.Play3DSE(position_, SEPath.GAME_SE_SUPPLY); } break; case NUTRIENTS_TYPE._B: { if (gunR_.Ammo == gunR_.MaxAmmo_) { return; } //gunR_.Reload(vrp.Charge(GunAmmoMAX_R - GunAmmoR)); Gun[] guns = new Gun[] { gunR_ }; vrp.Charge(guns); _audioManager.Play3DSE(position_, SEPath.GAME_SE_SUPPLY); } break; case NUTRIENTS_TYPE._ALL: { if (gunL_.Ammo == gunL_.MaxAmmo_ && gunR_.Ammo == gunR_.MaxAmmo_) { return; } //gunL_.Reload(vrp.Charge(GunAmmoMAX_L - GunAmmoL)); //gunR_.Reload(vrp.Charge(GunAmmoMAX_R - GunAmmoR)); Gun[] guns = new Gun[] { gunL_, gunR_ }; vrp.Charge(guns); _audioManager.Play3DSE(position_, SEPath.GAME_SE_SUPPLY); } break; } nutrientsRecoveryPoint_ = null; }