IEnumerator Attack() { anim.SetBool("isFiring", true); anim.SetTrigger("setFiring"); Debug.Log("Firing laser!", this); BeamTargeting.SetActive(true); yield return(new WaitForSeconds(2.5f)); BeamTargeting.SetActive(false); BeamFiring.SetActive(true); RaycastHit2D hit = Physics2D.Raycast(BeamOrigin.transform.position, Vector2.right, 30, entLayerMask); if (hit.collider != null) { OnHitObject(hit); } else { Debug.Log("Did not hit", this); } yield return(new WaitForSeconds(1f)); BeamFiring.SetActive(false); anim.GetBehaviour <RangedAim>().timerFire = false; anim.SetBool("isFiring", false); anim.SetBool("isAiming", false); }
public void Fire() { Debug.Log("Firing laser!", this); BeamTargeting.SetActive(false); BeamFiring.SetActive(true); sound.Play(); RaycastHit2D hit = Physics2D.Raycast(BeamOrigin.transform.position, Vector2.right, 30, entLayerMask); if (hit.collider != null) { OnHitObject(hit); } else { Debug.Log("Did not hit", this); } Invoke("ExitFiringState", 1f); }
private void ExitFiringState() { BeamFiring.SetActive(false); anim.SetBool("isFiring", false); anim.SetTrigger("firingComplete"); }