Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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);
 }