// Update is called once per frame void FixedUpdate() { if (behaviorActing) { attackTimeCountdown -= Time.deltaTime; if (!launchedAttack && attackTimeCountdown <= (attackDuration - attackWarmup)) { GameObject attackObj = Instantiate(attackPrefab, transform.position, Quaternion.identity) as GameObject; EnemyProjectileS projectileRef = attackObj.GetComponent <EnemyProjectileS>(); projectileRef.Fire(attackDirection, myEnemyReference); launchedAttack = true; } if (attackTimeCountdown <= 0) { EndAction(); } } }
// Update is called once per frame void FixedUpdate() { if (behaviorActing) { attackTimeCountdown -= Time.deltaTime; if (attackTimeCountdown <= 0) { currentAttack++; if (currentAttack > attackPrefab.Length - 1) { EndAction(); } else { if (!interruptIfOutOfRange || (interruptIfOutOfRange && AttackInRange())) { ResetAttack(); } else { EndAction(); } } } if (!launchedAttack && attackTimeCountdown <= (attackDuration - attackWarmup)) { GameObject attackObj = Instantiate(attackPrefab[currentAttack], transform.position, Quaternion.identity) as GameObject; EnemyProjectileS projectileRef = attackObj.GetComponent <EnemyProjectileS>(); projectileRef.Fire(attackDirection, myEnemyReference); launchedAttack = true; } } }