public override void Fire(WeaponSpawner spawner, WeaponFiringParameters firingParameters)
 {
     this.spawner = spawner;
     this.firingParameters = firingParameters;
     spawner.SpawnMuzzleFlash(firingParameters.hardpointTransform);
     transform.position = transform.position + (transform.forward * spawnOffset);
     float accuracy = ((spreadFactor + (spreadFactor * (1 - firingParameters.accuracy))) / spreadFactor) * spreadFactor;
     transform.rotation *= Quaternion.Euler(UnityEngine.Random.insideUnitSphere * accuracy);
     rigidbody.velocity = transform.forward * speed;
     rigidbody.angularVelocity = Vector3.zero;
     origin = transform.position;
     collider.enabled = false;
     elapsedTime = 0f;
 }
Esempio n. 2
0
 public override void Fire(WeaponSpawner spawner, WeaponFiringParameters firingParameters)
 {
     firingParameters.firingBeam = true;
     this.firingParameters = firingParameters;
     this.spawner = spawner;
     this.hardpoint = firingParameters.hardpointTransform;
     elapsedFireTime = 0f;
     beamLength = 0f;
     lineRenderer.SetPosition(1, new Vector3(0f, 0f, 0f));
     if (wanderRange != 0) {
         float accuracy = ((wanderRange + (wanderRange * (1 - firingParameters.accuracy))) / wanderRange) * wanderRange;
         transform.rotation *= Quaternion.Euler(UnityEngine.Random.insideUnitSphere * accuracy);
     }
 }
 public override void Fire(WeaponSpawner spawner, WeaponFiringParameters firingParameters)
 {
     this.spawner = spawner;
     this.firingParameters = firingParameters;
     this.distanceTravelled = 0f;
     transform.position = firingParameters.hardpointTransform.position;
     transform.rotation = firingParameters.hardpointTransform.rotation;
     if (spreadFactor != 0) {
         float accuracy = ((spreadFactor + (spreadFactor * (1 - firingParameters.accuracy))) / spreadFactor) * spreadFactor;
         transform.rotation *= Quaternion.Euler(UnityEngine.Random.insideUnitSphere * accuracy);
     }
     forward = transform.forward;
     spawner.SpawnMuzzleFlash(firingParameters.hardpointTransform);
     transform.position = transform.position + (forward * spawnOffset);
 }
Esempio n. 4
0
 public abstract void Fire(WeaponSpawner spawner, WeaponFiringParameters firingParameters);
Esempio n. 5
0
 public abstract bool CanFire(WeaponFiringParameters firingParameters);
Esempio n. 6
0
 public bool CanFire(WeaponFiringParameters firingParameters)
 {
     return weaponPool.CanSpawn && referenceWeapon.CanFire(firingParameters);
 }
Esempio n. 7
0
 public IWeapon Spawn(WeaponFiringParameters firingParameters)
 {
     GameObject weaponRoot = weaponPool.Spawn();
     IWeapon weapon = weaponRoot.GetComponent<IWeapon>();
     weaponRoot.transform.position = firingParameters.hardpointTransform.position;
     weaponRoot.transform.rotation = firingParameters.hardpointTransform.rotation;
     if (hasTrail) {
         weapon.gameObject.GetComponent<TrailRenderer>().time = trailTime;
     }
     weapon.Fire(this, firingParameters);
     return weapon;
 }
Esempio n. 8
0
 public override void Fire(WeaponSpawner spawner, WeaponFiringParameters firingParameters)
 {
     this.spawner = spawner;
     this.firingParameters = firingParameters;
 }
Esempio n. 9
0
 public override bool CanFire(WeaponFiringParameters firingParameters)
 {
     float lastFireTime = firingParameters.lastFireTime;
     return Time.time - lastFireTime > fireRate;
 }
Esempio n. 10
0
 public override bool CanFire(WeaponFiringParameters fp)
 {
     if (fp.firingBeam) return false;
     float lastFireTime = fp.lastFireTime;
     return Time.time - lastFireTime > fireRate;
 }
Esempio n. 11
0
 public void Start()
 {
     spawner = WeaponSpawner.Get(weaponId);
     entity = GetComponentInParent<Entity>();
     firingParameters = new WeaponFiringParameters(entity);
 }
Esempio n. 12
0
 public void Start()
 {
     spawner = WeaponSpawner.Get(weaponId);
     Entity entity = GetComponentInParent<Entity>();
     firepoints = new List<Firepoint>();
     firingParameters = new WeaponFiringParameters(entity);
     currentFirepointIndex = 0;
     Firepoint[] childFirepoints = GetComponentsInChildren<Firepoint>();
     for (int i = 0; i < childFirepoints.Length; i++) {
         if (childFirepoints[i].weaponGroupId == groupId) {
             firepoints.Add(childFirepoints[i]);
         }
     }
 }