public IEnumerator AimWeapon() { currentGun.transform.rotation = GunFunctions.CalcPlayerToMouseAngle(transform.position); yield return(new WaitForSeconds(0.5f)); IdleWeapon(); }
public void LavaExplosion(Transform spawnPos) { particleHost.position = spawnPos.position; for (int i = 0; i < maxParticles / 2; i++) { float randomSpeed = UnityEngine.Random.Range(minSpeed, maxSpeed); objectPool.GetObj().InitialiseObj(GunFunctions.calcSpreadShot(transform.position, -minSpread, maxSpread), minSpread, maxSpread, randomSpeed, spawnPos); } }
//Special attack public override IEnumerator Special() { for (int i = 0; i < specialBulletAmount; i++) { Quaternion rot = GunFunctions.calcSpreadShot(this.transform.position, -minSpread, maxSpread); GameObject go = Instantiate(specialBulletPrefab, shootPos.transform.position, rot); go.GetComponent <IBullet>().SetupStats(specialBulletSpeed, specialBulletDmg, new Vector2(1, 0)); //Feedback GunFunctions.KnockBack(player.GetComponent <Rigidbody2D>(), (rot * transform.right * -1), shotForce); StartCoroutine(cam.GetComponent <CameraScript>().CameraShake(shotCameraShakeForce, shotCameraDuration + 0.2f)); //Wouter HeavyGunShot FMODUnity.RuntimeManager.PlayOneShot("event:/Weapon/GrenadeLauncherShot"); } yield return(null); }
public IEnumerator SpewLavaOverTime() { float t = 0; while (true) { yield return(null); float randomSpeed = UnityEngine.Random.Range(minSpeed, maxSpeed); objectPool.GetObj().InitialiseObj(GunFunctions.calcSpreadShot(transform.position, -minSpread, maxSpread), minSpread, maxSpread, randomSpeed, spawnPos); t += Time.deltaTime; if (t > spewTime) { break; } } }
//Normal attack public override void Shoot() { if (!bulletPrefab) { return; } Quaternion rot = GunFunctions.CalcPlayerToMouseAngle(this.transform.position); GameObject go = Instantiate(bulletPrefab, shootPos.transform.position, rot); go.GetComponent <IBullet>().SetupStats(bulletSpeed, bulletDmg, new Vector2(1, 0)); //Feedback GunFunctions.KnockBack(player.GetComponent <Rigidbody2D>(), (rot * transform.right * -1), shotForce); StartCoroutine(cam.GetComponent <CameraScript>().CameraShake(shotCameraShakeForce, shotCameraDuration)); //Wouter PlasmaGunShot FMODUnity.RuntimeManager.PlayOneShot("event:/Weapon/GrenadeLauncherShot"); }