void FixedUpdate() { timeSinceMine += Time.fixedDeltaTime; MoveTowardsPosition(body.position + direction); if (timeSinceMine >= mineLayingInterval) { direction.y = Random.Range(-0.5f, 0.5f); enemyFiring.FireBurst(Vector2.zero, 1); timeSinceMine = 0; } if (transform.position.y > 4) { direction.y = -1; } else if (body.position.y < -4) { direction.y = 1; } }
void FixedUpdate() { if (abducting) { Abduct(); } else if (player != null) { if (!hasAttemptedAbduction) { AttemptAbduction(); } else if (Vector2.Distance(player.position, transform.position) > 5) { MoveTowardsPosition(player.position); } else { enemyFiring.FireBurst(player.position - transform.position, 4); } } }