override public IEnumerator Strike() { if (!isDead && !isStriking && !Physics.Linecast(GunMuzzle.transform.position, Gun.instance.transform.position, ~(1 << 2))) { Debug.Log("SHOOT"); isStriking = true; myAgent.isStopped = true; AnimationContorller.SetBool("Attack", true); yield return(new WaitForSeconds(BulletDelay)); if (!isDead && myAgent) { Vector3 GoalPos = GunMuzzle.transform.position; var newBullet = Instantiate(Bullet, GoalPos, Quaternion.identity); newBullet.GetComponent <EnemyBullet>().Damage = strikeDamage; yield return(new WaitForSeconds(0.1f)); myAgent.isStopped = false; yield return(new WaitForSeconds(TimeBetweenAttacks)); isStriking = false; } } }
override public IEnumerator Strike() { if (!isDead) { isStriking = true; myAgent.isStopped = true; if (this.gameObject.name.Contains("Golem")) { GetComponent <AudioSource>().Play(); AnimationContorller.SetTrigger("Attack"); Tornado.SetActive(true); } yield return(new WaitForSeconds(0.25f)); foreach (GameObject Arm in Arms) { if (!isDead) { Arm.gameObject.GetComponent <Collider>().enabled = true; } } StartCoroutine("WaitForDodge"); yield return(new WaitForSeconds(strikeTime * 3 / 4)); foreach (GameObject Arm in Arms) { if (Arm) { //Debug.Log("turn off arm colliders"); Arm.gameObject.GetComponent <Collider>().enabled = false; } } //Tornado.SetActive(false); if (myAgent) { if (myAgent.enabled) { myAgent.isStopped = false; } } isStriking = false; } }