protected override void Firing(WeaponFireContext context) { InitialisateEffects(context.userTrans); firePos = context.userTrans.position + context.firePos; fireDir = (context.targetVector - context.firePos).normalized; if (muzzleFlashEffect) { muzzleFlashEffect.transform.position = firePos; muzzleFlashEffect.transform.LookAt(firePos + fireDir); muzzleFlashEffect.Play(); } RaycastHit hit; if (Physics.Raycast(firePos, fireDir, out hit, configFile.Range)) { if (upgradeAmmo > 0) { ApplyDamageToEnemy(hit.collider, configFile.Damage * configFile.UpgradeDamageMultiplier); PlayImpactEffect(upgradeImpactEffect, hit); } else { ApplyDamageToEnemy(hit.collider, configFile.Damage); PlayImpactEffect(impactEffect, hit); } } if (configFile.AudioEffects.Length > 0) { PlaySoundEffect(configFile.AudioEffects[Random.Range(0, configFile.AudioEffects.Length)]); } }
protected override void Firing(WeaponFireContext context) { GameObject newBullet = GameObject.Instantiate(configFile.InstantiatableObjects[0], context.userTrans.position + context.firePos, Quaternion.identity); newBullet.GetComponent <ExplosiveProjectile>().Fire(CalculateMortarVelocity(context.targetVector - context.firePos, configFile.FloatValue[ValueName.MinCurvatureHeight]), configFile.Damage, configFile.FloatValue[ValueName.ExplosionRadius]); Debug.DrawLine(context.userTrans.position + context.firePos, context.userTrans.position + context.firePos + (context.targetVector - context.firePos), Color.red, 1.0f); }
public void Fire(WeaponFireContext context) { if (ReadyToUse()) { Firing(context); PostFireUpdates(); } }
protected override void Firing(WeaponFireContext context) { newMissle = GameObject.Instantiate(configFile.InstantiatableObjects[0], context.userTrans.position + context.firePos, context.userTrans.rotation); newMissle.GetComponent <ExplosiveProjectile>().Fire(context.targetVector.normalized * configFile.Velocity, configFile.Damage, configFile.FloatValue[ValueName.ExplosionRadius]); }
protected override void Firing(WeaponFireContext context) { base.Firing(context); newMissle.GetComponent <HomingGuidance>().GiveTarget(context.target, configFile.FloatValue[ValueName.SeekForce], configFile.FloatValue[ValueName.MaxVelocity]); }
protected abstract void Firing(WeaponFireContext context);