private void FanShoot()
    {
        List <Vector2> canonDirections = new List <Vector2>();

        Vector2 centralVector = new Vector2(mPlayer.position.x - transform.position.x, mPlayer.position.y - transform.position.y).normalized;

        canonDirections.Add(centralVector);

        Vector2 canonTemp;

        for (int i = 0; i < mNumberOfExtraCanons / 2; ++i)
        {
            canonTemp = StaticFunctions.RotateVector2(centralVector, mAngleBetweenCanons * (i + 1));
            canonDirections.Add(canonTemp.normalized);
            canonTemp = StaticFunctions.RotateVector2(centralVector, -mAngleBetweenCanons * (i + 1));
            canonDirections.Add(canonTemp.normalized);
        }

        foreach (Vector2 direction in canonDirections)
        {
            //Debug.DrawRay(transform.position, direction, Color.yellow,2f);
            Vector3 direction3 = new Vector3(direction.x, direction.y, 0f);
            mSpawner.SpawnBullet(mBulletType, mOwner.GetSpeedIncrement(), transform.position + direction3 * mCanonDistance, direction3);

            mShootAudio.Play();
        }
    }
Exemplo n.º 2
0
 public void ShootAt(Transform targetEnemy)
 {
     if (canShoot)
     {
         GameObject gm     = spawner.SpawnBullet(spawnPoint.position, spawnPoint.rotation);
         Bullet     bullet = gm.GetComponent <Bullet> ();
         bullet.owner           = owner;
         bullet.damage          = damage;
         bullet.targetTransform = targetEnemy;
         ResetShoot();
     }
 }
Exemplo n.º 3
0
 public override void beginGame()
 {
     StartCoroutine(bspawner.SpawnBullet());
     StartCoroutine(Win());
     Player.beginPlay = true;
 }
 /// <summary> Spawn bullet and make cooldown </summary>
 public void WeaponShoot(float dmg, float delay, bool isReloading)
 {
     bulletSpawner.SpawnBullet(transform.position, transform.forward, dmg);
     StartCoroutine(Delay(delay, isReloading));
 }