void Effect() { //Quaternion rot = Quaternion.Euler(Random.Range(-25.0f, 25.0f), Random.Range(-25.0f, 25.0f), 0); Transform bullet = Instantiate(bulletTrailPrefab, firePoint.position, firePoint.rotation); MoveTrail trail = bullet.GetComponent <MoveTrail>(); trail.setDamage(weaponDamage); if (!didHit) { trail.setScoreMultiplier(1); //Reset Score Multiplier. } else if ((Time.time - this.lastShotTime) < 1) //If the time from the last shot is less than 1 second, then add to the score multiplier. { trail.setScoreMultiplier(trail.getScoreMultiplier() + (Time.time - this.lastShotTime)); //Increment Score Multiplier. } GameMaster.updateScoreMultiplier(trail.getScoreMultiplier()); //Update the score multiplier. //bulletTrailPrefab.rotation *= rot; AudioSource.PlayClipAtPoint(gunShotAudio, new Vector3(firePoint.position.x, firePoint.position.y, firePoint.position.z), gunShotVolume); Transform muzzleClone = Instantiate(muzzleFlashPrefab, firePoint.position, firePoint.rotation) as Transform; muzzleClone.parent = firePoint; float size = Random.Range(5.5f, 6f); muzzleClone.localScale = new Vector3(size, size, size); Destroy(muzzleClone.gameObject, 0.05f); rotZ += Random.Range(0, 360); shellPoint.rotation = Quaternion.Euler(shellPoint.rotation.x, shellPoint.rotation.y, rotZ); Transform shellClone = Instantiate(bulletShellPrefab, shellPoint.position, shellPoint.rotation) as Transform; shellClone.localScale = new Vector3(shellScale, shellScale, shellScale); Destroy(shellClone.gameObject, 10f); }
// Start is called before the first frame update void Start() { player = GameObject.FindObjectOfType <PlayerController>(); grapple = GameObject.FindObjectOfType <MoveTrail>(); }