public static SquidProjectile Create(Vector2 spawnPosition, Vector2 targetPosition) { Transform pfProjectile = Resources.Load <Transform>("pfSquidProjectile"); Transform projectileTransform = Instantiate(pfProjectile, spawnPosition, Quaternion.identity); SquidProjectile projectile = projectileTransform.GetComponent <SquidProjectile>(); projectile.SetTargetPosition(targetPosition); return(projectile); }
private void HandleAttack() { shootTimer -= Time.deltaTime; if (bossPhase != BossPhase.Intro && shootTimer <= 0 && isAlive && player != null) { foreach (Transform shotTransform in shootingPositions) { SquidProjectile.Create(shotTransform.position, player.position); } if (bossPhase == BossPhase.SecondPhase) { //Need to make a sub-timer for separating the lasers after they spawn. Otherwise, they'll all be on top of each other SquidLaserProjectile.Create(laserPositions[0].position, player.position); SquidLaserProjectile.Create(laserPositions[1].position, player.position); } shootTimer = shootTimerMax; } }