public GunParameter GunParameterSet() { switch (gunType) { case GunType.GunType1: gunParameter_GunType = new GunParameter() { moveSpeed = 200, bulletCount = 30, allBulletCount = 180, rateOfFire = 0.08f, timer_ChangeAmmunition = 1.3f, maxDistance = 50f, bulletPower = 15f }; break; case GunType.GunType2: gunParameter_GunType = new GunParameter() { moveSpeed = 100, bulletCount = 100000, allBulletCount = 10000, rateOfFire = 0.116f, timer_ChangeAmmunition = 2.3f, maxDistance = 70f, bulletPower = 40f }; break; case GunType.GunType3: gunParameter_GunType = new GunParameter() { moveSpeed = 800, bulletCount = 10, allBulletCount = 60, rateOfFire = 1f, timer_ChangeAmmunition = 1.5f, maxDistance = 200f, bulletPower = 100f }; break; default: break; } return(gunParameter_GunType); }
/// <summary> /// 初始化枪的参数 /// </summary> private void Init() { shootManage.gunType = MyGunType; gunParameter_GunType = shootManage.GunParameterSet(); moveSpeed = gunParameter_GunType.moveSpeed; bulletCount = gunParameter_GunType.bulletCount; AllBulletCount = gunParameter_GunType.allBulletCount; rateOfFire = gunParameter_GunType.rateOfFire; timer_ChangeAmmunition = gunParameter_GunType.timer_ChangeAmmunition; maxDistance = gunParameter_GunType.maxDistance; bulletPower = gunParameter_GunType.bulletPower; rateOfFire_Init = rateOfFire; bulletCount_Init = bulletCount; timer_ChangeAmmunition_Init = timer_ChangeAmmunition; TimeImage.fillAmount = 0; bulletCount_Text.text = bulletCount + "/" + AllBulletCount; }