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; }
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); }
public abstract void Fire(WeaponSpawner spawner, WeaponFiringParameters firingParameters);
public abstract bool CanFire(WeaponFiringParameters firingParameters);
public bool CanFire(WeaponFiringParameters firingParameters) { return weaponPool.CanSpawn && referenceWeapon.CanFire(firingParameters); }
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; }
public override void Fire(WeaponSpawner spawner, WeaponFiringParameters firingParameters) { this.spawner = spawner; this.firingParameters = firingParameters; }
public override bool CanFire(WeaponFiringParameters firingParameters) { float lastFireTime = firingParameters.lastFireTime; return Time.time - lastFireTime > fireRate; }
public override bool CanFire(WeaponFiringParameters fp) { if (fp.firingBeam) return false; float lastFireTime = fp.lastFireTime; return Time.time - lastFireTime > fireRate; }
public void Start() { spawner = WeaponSpawner.Get(weaponId); entity = GetComponentInParent<Entity>(); firingParameters = new WeaponFiringParameters(entity); }
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]); } } }