public static SquidLaserProjectile Create(Vector2 spawnPosition, Vector2 targetPosition)
    {
        Transform pfProjectile        = Resources.Load <Transform>("pfSquidLaserProjectile");
        Transform projectileTransform = Instantiate(pfProjectile, spawnPosition, Quaternion.identity);

        SquidLaserProjectile projectile = projectileTransform.GetComponent <SquidLaserProjectile>();

        projectile.SetTargetPosition(targetPosition);
        projectile.SetDirection(spawnPosition, targetPosition);

        return(projectile);
    }
Exemple #2
0
    private void ProcessFiring()
    {
        shootTimer -= Time.deltaTime;

        if (shootTimer < 0)
        {
            // Should make it so the laser just shoots to the right and keeps going straight
            Vector2 targetPosition = new Vector2((transform.position.x + 2f) * side, transform.position.y);

            SquidLaserProjectile.Create(shootingPosition.position, targetPosition);

            shootTimer = shootTimerMax;
            SoundManager.Instance.PlaySound(SoundManager.Sounds.PlasmaShot);
        }
    }
Exemple #3
0
    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;
        }
    }
Exemple #4
0
    private void ProcessFiring()
    {
        shootTimer -= Time.deltaTime;

        if (shootTimer < 0)
        {
            for (int i = 0; i < 4; i++)
            {
                SquidLaserProjectile.Create(shootingPositions[i].position, shootingTarget[i].position);
            }
            shootTimer = shootTimeMax;

            if (playSound)
            {
                SoundManager.Instance.PlaySound(SoundManager.Sounds.PlasmaShot);
            }
            else
            {
                playSound = !playSound;
            }
        }
    }