private void Update() { Vector3 difference = Vector3.Normalize(Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position); if (timeBtwShots <= 0) { if (Input.GetMouseButton(0)) { Instantiate(shotEffect, shotPoint.position, Quaternion.identity); shooty.Play(); Instantiate(projectile, shotPoint.position, transform.rotation); cs.ShakeCam(2.5f, .1f); rb.AddForce(-1 * KnockForce * difference); timeBtwShots = startTimeBtwShots; } } else { timeBtwShots -= Time.deltaTime; } }
public void Effect() { Instantiate(ExplodeEffect, transform.position, Quaternion.identity); Shake.ShakeCam(); }