Exemple #1
0
        protected override void EnemyLaunchSingleShotAttack()
        {
            BombBullet bombBulletInstance = (BombBullet)bombPrefab.Instance();

            GetParent().AddChild(bombBulletInstance);

            Node2D launchPoint = _launchPoints[0];

            bombBulletInstance.SetGlobalPosition(launchPoint.GetGlobalPosition());

            float   rotation     = _rotationNode.GetGlobalRotation();
            float   xVelocity    = Mathf.Cos(rotation);
            float   yVelocity    = Mathf.Sin(rotation);
            Vector2 launchVector = new Vector2(xVelocity, yVelocity);

            bombBulletInstance.LaunchBullet(launchVector.Normalized());
        }
Exemple #2
0
 public override void FireBullet()
 {
     if (currentBomb)
     {
         currentBomb.Launch();
         currentBomb = null;
     }
     else if (bulletType)
     {
         if (fireSources.Count <= 0)
         {
             GameObject newBomb = Instantiate(bulletType, transform.position, Quaternion.identity);
             newBomb.transform.SetParent(transform);
             currentBomb = newBomb.GetComponent <BombBullet>();
         }
         else
         {
             GameObject newBomb = Instantiate(bulletType, fireSources[0].transform.position, Quaternion.identity);
             newBomb.transform.SetParent(fireSources[0].transform);
             currentBomb = newBomb.GetComponent <BombBullet>();
         }
     }
 }
Exemple #3
0
    public override void FireBullet()
    {
        switch (bossState)
        {
        case BossState.Idle:
            break;

        case BossState.LazyBlaster:
        case BossState.RapidBlaster:
            if (bulletType)
            {
                if (fireSources.Count <= 0)
                {
                    Instantiate(bulletType, transform.position, Quaternion.identity);
                }
                else
                {
                    foreach (GameObject fireSource in fireSources)
                    {
                        Instantiate(bulletType, fireSource.transform.position, Quaternion.identity);
                    }
                }
            }
            break;

        case BossState.ChargeBeam:
            ChargeWeapon();
            break;

        case BossState.LightningStorm:
            if (boltBullets.Count > 0)
            {
                int boltNum = Random.Range(0, boltBullets.Count);
                boltBullets[boltNum].LightningStrike();
                activeBolts.Add(boltBullets[boltNum]);
                boltBullets.RemoveAt(boltNum);
            }
            break;

        case BossState.Bomber:
            if (bombBullet)
            {
                if (fireSources.Count <= 0)
                {
                    BombBullet newBomb = Instantiate(bombBullet, transform.position, Quaternion.identity).GetComponent <BombBullet>();
                    newBomb.Launch();
                }
                else
                {
                    foreach (GameObject fireSource in fireSources)
                    {
                        BombBullet newBomb = Instantiate(bombBullet, fireSource.transform.position, Quaternion.identity).GetComponent <BombBullet>();
                        newBomb.Launch();
                    }
                }
            }
            break;

        default:
            break;
        }
    }
Exemple #4
0
 public override void Start()
 {
     base.Start();
     currentBomb = GetComponentInChildren <BombBullet>();
 }