Exemple #1
0
        public void NormalShoot(List <Sprite> sprites)
        {
            var bullet =
                BulletManager.GetBullet(new Vector2(0, 1), new Vector2(Position.X - 50, Position.Y + 40), 3, this,
                                        (int)Config.TrackStyle.NormalWithBias, 1, (int)Config.BulletStyle.Bullet3);
            var bullet1 =
                BulletManager.GetBullet(new Vector2(0, 1), new Vector2(Position.X - 20, Position.Y + 40), 3, this,
                                        (int)Config.TrackStyle.NormalWithBias, 1, (int)Config.BulletStyle.Bullet3);
            var bullet2 =
                BulletManager.GetBullet(new Vector2(0, 1), new Vector2(Position.X + 20, Position.Y + 40), 3, this,
                                        (int)Config.TrackStyle.NormalWithBias, 1, (int)Config.BulletStyle.Bullet3);
            var bullet3 =
                BulletManager.GetBullet(new Vector2(0, 1), new Vector2(Position.X + 50, Position.Y + 40), 3, this,
                                        (int)Config.TrackStyle.NormalWithBias, 1, (int)Config.BulletStyle.Bullet3);


            if (Power == 0)
            {
                Power = bullet.Power;
            }
            sprites.Add(bullet);
            sprites.Add(bullet1);
            sprites.Add(bullet2);
            sprites.Add(bullet3);
        }
Exemple #2
0
 private void FireBullet()
 {
     if (Time.frameCount % 60 == 0)
     {
         bulletManager.GetBullet(BulletType.PlayerBullet, gameObject.transform.position);
     }
 }
Exemple #3
0
    private void fire(Vector3 direction)
    {
        Bullet _bullet = BulletManager.GetBullet();

        _bullet.transform.position = transform.position + direction;
        _bullet.Fire(direction, FireType == EFireType.Fast ? 50 : 10, Power);
    }
 private void _FireBullet()
 {
     if (Time.frameCount % 20 == 0)
     {
         bulletManager.GetBullet(transform.position);
     }
 }
 private void FireBullet()
 {
     // Delays The bullet Coming out
     if (Time.frameCount % 5 == 0)
     {
         bulletManager.GetBullet(transform.position);
     }
 }
 private void _FireBullet()
 {
     //delay bullet firing every 40 frames
     if (Time.frameCount % 40 == 0)
     {
         bulletManager.GetBullet(transform.position);
     }
 }
Exemple #7
0
 private void FireBullet()
 {
     if (Time.frameCount % 6 == 0 && GameUI.gamePaused == false) // Editor value - 60
     {
         bulletManager.GetBullet(transform.position);
         SoundManager.PlaySound("sfx_laser1");
     }
 }
Exemple #8
0
    private void FireBullet()
    {
        _soundManager.DoBulletSound();
        Bullet bullet = _bulletManager.GetBullet();

        bullet.Fire(_firePosition);
        _lastTimeFire = Time.time;
    }
 private void _FireBullet()
 {
     // delay bullet firing
     if (Time.frameCount % 60 == 0 && bulletManager.HasBullets())
     {
         bulletManager.GetBullet(transform.position);
     }
 }
Exemple #10
0
 private void _FireBullet()
 {
     // delay bullet firing
     if (Time.frameCount % 120 == 0 && bulletManager.HasBullets())
     {
         FindObjectOfType <AudioManager>().PlaySound("FireBullet");
         bulletManager.GetBullet(transform.position + new Vector3(0.0f, 1.0f));
     }
 }
Exemple #11
0
 public void Fire()
 {
     if (firingDelay >= 1.0f)
     {
         if (facingRight)
         {
             bulletManager.GetBullet(bulletSpawnPoint.position, 1);
             firingDelay = 0;
         }
         else
         {
             bulletManager.GetBullet(bulletSpawnPoint.position, -1);
             firingDelay = 0;
         }
         audioSource.clip = soundEffects[(int)ImpulseSounds.SHOOT];
         audioSource.Play();
     }
 }
    //Aim and shoot at player
    private void shootPlayer()
    {
        Bullet  _bullet    = BulletManager.GetBullet();
        Vector3 _direction = (m_player.transform.position - transform.position);

        _direction = new Vector2(_direction.x, _direction.y).normalized;
        _bullet.transform.position = transform.position + _direction;
        _bullet.Fire(_direction, 7.5f, Damage, false);
    }
 public void Fire()
 {
     if (firingDelay >= 0.5f)
     {
         bulletManager.GetBullet(new Vector3(transform.position.x, transform.position.y + 0.6f, transform.position.z));
         firingDelay = 0; // Reset the timer
         GetComponent <AudioSource>().clip = soundclips[0];
         GetComponent <AudioSource>().Play();
     }
 }
Exemple #14
0
        public override void AddBullet(List <Sprite> sprites)
        {
            var bullet =
                BulletManager.GetBullet(Direction, Position, LinearVelocity, this, (int)Config.TrackStyle.NormalTrack, 2, (int)Config.BulletStyle.Bullet0);

            if (Power == 0)
            {
                Power = bullet.Power;
            }
            sprites.Add(bullet);
        }
Exemple #15
0
    IEnumerator FireBullet()
    {
        if (!firing)
        {
            bulletManager.GetBullet(transform.position);
            firing = true;
            yield return(new WaitForSeconds(fireRate));

            firing = false;
        }
    }
Exemple #16
0
    public void FireBullet(int index, Vector3 position, Vector2 direction, string bulletLayer)
    {
        Bullet newBullet = GetActive().GetComponent <Bullet>();

        newBullet.gameObject.layer = LayerMask.NameToLayer(bulletLayer);
        BulletData thisData = bulletData.GetBullet(index);

        newBullet.gameObject.SetActive(true);
        newBullet.Initialize(thisData.animator, thisData.radius, direction.normalized * thisData.speed);
        newBullet.transform.position = position;
    }
Exemple #17
0
 public void _FireBullet()
 {
     positionBullet.x = transform.position.x - 0.2f;
     positionBullet.y = transform.position.y + 0.9f;
     positionBullet.z = transform.position.z;
     // delay bullet firing
     if (Time.frameCount % 30 == 0 && bulletManager.HasBullets())
     {
         bulletManager.GetBullet(positionBullet);
     }
 }
Exemple #18
0
        public override void Shoot(List <Sprite> sprites)
        {
            var bullet =
                BulletManager.GetBullet(new Vector2(0, 1), Position, 1.5f, this, (int)Config.TrackStyle.TailTrack, 1, (int)Config.BulletStyle.Bullet1);

            if (Power == 0)
            {
                Power = bullet.Power;
            }
            sprites.Add(bullet);
        }
Exemple #19
0
    //Previous movement, will be deleted later
    //void FixedUpdate()
    //{
    //    float moveHorizontal = Input.GetAxis("Horizontal");
    //    float moveVertical = Input.GetAxis("Vertical");
    //    Vector2 movement = new Vector2(moveHorizontal, moveVertical);

    //    movement *= Time.deltaTime;
    //    movement *= speed;



    //    // rb2d.AddForce(movement);
    //    transform.Translate(movement);


    //}

    private void _FireBullet()
    {
        if (Input.touchCount > 0)
        {
            if (Time.frameCount % 60 == 0)
            {
                //Vector3 bulletPosition = new Vector3(transform.position.x, transform.position.y + 1.1f, transform.position.z);
                bulletManager.GetBullet(transform.position);
                SoundManagerScript.PlaySound("shoot");
            }
        }
    }
 private void _Fire()
 {
     if (Input.GetAxisRaw("Fire1") > 0.0f)
     {
         // delays firing
         if (Time.frameCount % fireRate == 0)
         {
             var tempBullet = bulletManager.GetBullet(bulletSpawn.position, bulletSpawn.forward);
             tempBullet.transform.SetParent(bulletManager.gameObject.transform);
         }
     }
 }
Exemple #21
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.Space))
     {
         Bullet newBullet = bulletManager.GetBullet();
         if (newBullet)
         {
             newBullet.transform.position = nozzle.transform.position;
             newBullet.transform.rotation = nozzle.transform.rotation;
             newBullet.rigidbody.velocity = nozzle.transform.up * speed;
         }
     }
 }
Exemple #22
0
    private void _Fire()
    {
        if (Input.GetMouseButtonDown(0))
        {
            // delays firing
            //  if (Time.frameCount % fireRate == 0)
            // {

            var tempBullet = bulletManager.GetBullet(bulletSpawn.position, bulletSpawn.forward);
            tempBullet.transform.SetParent(bulletManager.gameObject.transform);
            // }
        }
    }
Exemple #23
0
 private void _Fire()
 {
     if (Input.GetMouseButton(0))
     {
         // delays firing
         if (Time.frameCount - lastFrame >= fireRate)
         {
             var tempBullet = bulletManager.GetBullet(bulletSpawn.position, bulletSpawn.forward);
             tempBullet.transform.SetParent(bulletManager.gameObject.transform);
             lastFrame = Time.frameCount;
             shootSound.Play();
         }
     }
 }
Exemple #24
0
    void Shoot()
    {
        if (myTimerInBetweenshots >= myTimeInBetweenShots)
        {
            myShootEffect.Play();

            AudioManager.ourPublicInstance.PlaySFX1(myShootClip, myShootVolume);
            myBulletManager.GetBullet(transform.position, transform.rotation, mySpeed, damage, bulletLifeTime, myScale);
            myTimerInBetweenshots = 0;
        }
        else
        {
            myTimerInBetweenshots = myTimerInBetweenshots + Time.deltaTime;
        }
    }
Exemple #25
0
 private void _Fire()
 {
     if (Input.GetAxisRaw("Fire1") > 0.0f)
     {
         // delays firing
         if (Time.frameCount % fireRate == 0)
         {
             var tempBullet = bulletManager.GetBullet(bulletSpawn.position, bulletSpawn.forward);
             tempBullet.transform.SetParent(bulletManager.gameObject.transform);
         }
     }
     if (Input.GetKeyDown(KeyCode.P)) //key p to go back to main scene
     {
         m_sceneManager.openScene("StartScene");
         //UnityEngine.SceneManagement.SceneManager.LoadScene("StartScene", UnityEngine.SceneManagement.LoadSceneMode.Single);
     }
 }
Exemple #26
0
 private void _Fire()
 {
     if (Input.GetAxisRaw("Fire1") > 0.0f)
     {
         fireTimer += Time.deltaTime;
         // delays firing
         if (fireTimer - fireInterval > 0)
         {
             fireTimer -= fireInterval;
             var tempBullet = bulletManager.GetBullet(bulletSpawn.position, bulletSpawn.forward);
             tempBullet.transform.SetParent(bulletManager.gameObject.transform);
         }
     }
     else
     {
         fireTimer = 0.0f;
     }
 }
Exemple #27
0
        public override void Shoot(List <Sprite> sprites)
        {
            var bullet1 =
                BulletManager.GetBullet(new Vector2(0, 1), Position, 1.5f, this, (int)Config.TrackStyle.TailTrack, 1, (int)Config.BulletStyle.Bullet1);

            //var track1 = new ConstTailTrack(this.left);
            //var track2 = new ConstTailTrack(this.right);
            var bullet2 =
                BulletManager.GetTrackBullet(new Vector2(0, 1), Position, 1.5f, this, (int)Config.TrackStyle.TailTrack, 1, (int)Config.BulletStyle.Bullet1, left);
            var bullet3 =
                BulletManager.GetTrackBullet(new Vector2(0, 1), Position, 1.5f, this, (int)Config.TrackStyle.TailTrack, 1, (int)Config.BulletStyle.Bullet1, right);

            if (Power == 0)
            {
                Power = bullet1.Power;
            }
            sprites.Add(bullet1);
            sprites.Add(bullet2);
            sprites.Add(bullet3);
        }
Exemple #28
0
        public void LastShoot(List <Sprite> sprites)
        {
            var bullet = BulletManager.GetBullet(new Vector2(0, 1), new Vector2(Position.X, Position.Y + 20), 3, this,
                                                 (int)Config.TrackStyle.TailTrack, 1, (int)Config.BulletStyle.Bullet2);

            var bullet2 = BulletManager.GetBullet(new Vector2(-1, 1), new Vector2(Position.X - 40, Position.Y + 20), 3, this,
                                                  (int)Config.TrackStyle.TailTrack, 1, (int)Config.BulletStyle.Bullet2);

            var bullet3 = BulletManager.GetBullet(new Vector2(1, 1), new Vector2(Position.X + 40, Position.Y + 20), 3, this,
                                                  (int)Config.TrackStyle.TailTrack, 1, (int)Config.BulletStyle.Bullet2);


            if (Power == 0)
            {
                Power = bullet.Power;
            }
            sprites.Add(bullet);
            sprites.Add(bullet2);
            sprites.Add(bullet3);
        }
Exemple #29
0
        public override void Shoot(List <Sprite> sprites)
        {
            var bullet =
                BulletManager.GetBullet(new Vector2(0, 1), Position, 2, this, (int)Config.TrackStyle.TailTrack, 1, (int)Config.BulletStyle.Bullet1);
            float b2x     = bullet.Direction.X + bias;
            float b2y     = (float)Math.Sqrt(1 - Math.Pow(b2x, 2));
            float b3x     = bullet.Direction.X - bias;
            float b3y     = (float)Math.Sqrt(1 - Math.Pow(b3x, 2));
            var   b2      = new Vector2(b2x, b2y);
            var   b3      = new Vector2(b3x, b3y);
            var   bullet2 =
                BulletManager.GetBullet(b2, Position, 2, this, (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet1);
            var bullet3 =
                BulletManager.GetBullet(b3, Position, 2, this, (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet1);

            if (Power == 0)
            {
                Power = bullet.Power;
            }
            sprites.Add(bullet);
            sprites.Add(bullet2);
            sprites.Add(bullet3);
        }
Exemple #30
0
        public void S_CrazyShoot(List <Sprite> sprites)
        {
            //var bullet =
            //    BulletManager.GetBullet(new Vector2(0, 1), Position, 3, this,
            //    (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            //var bullet1 =
            //    BulletManager.GetBullet(new Vector2(1, 0), Position, 3, this,
            //    (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            //var bullet2 =
            //    BulletManager.GetBullet(new Vector2(-1, 1), Position, 3, this,
            //    (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            //var bullet3 =
            //    BulletManager.GetBullet(new Vector2(1, -1), Position, 3, this,
            //    (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            //var bullet4 =
            //    BulletManager.GetBullet(new Vector2(0, -1), Position, 3, this,
            //    (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            //var bullet5 =
            //    BulletManager.GetBullet(new Vector2(-1, 0), Position, 3, this,
            //    (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            //var bullet6 =
            //    BulletManager.GetBullet(new Vector2(1, 1), Position, 3, this,
            //    (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            //var bullet7 =
            //    BulletManager.GetBullet(new Vector2(-1, -1), Position, 3, this,
            //    (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            var bullet =
                BulletManager.GetBullet(new Vector2(0, 1), Position, 3, this,
                                        (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            var bullet1 =
                BulletManager.GetBullet(new Vector2(1, 1), Position, 3, this,
                                        (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            var bullet2 =
                BulletManager.GetBullet(new Vector2(-1, 1), Position, 3, this,
                                        (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            var bullet3 =
                BulletManager.GetBullet(new Vector2(0.25f, 1), Position, 3, this,
                                        (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            var bullet4 =
                BulletManager.GetBullet(new Vector2(-0.25f, 1), Position, 3, this,
                                        (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            var bullet5 =
                BulletManager.GetBullet(new Vector2(0.75f, 1), Position, 3, this,
                                        (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            var bullet6 =
                BulletManager.GetBullet(new Vector2(-0.75f, 1), Position, 3, this,
                                        (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            var bullet7 =
                BulletManager.GetBullet(new Vector2(0.50f, 1), Position, 3, this,
                                        (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);
            var bullet8 =
                BulletManager.GetBullet(new Vector2(-0.50f, 1), Position, 3, this,
                                        (int)Config.TrackStyle.NormalTrack, 1, (int)Config.BulletStyle.Bullet3);



            if (Power == 0)
            {
                Power = bullet.Power;
            }
            sprites.Add(bullet);
            sprites.Add(bullet1);
            sprites.Add(bullet2);
            sprites.Add(bullet3);
            sprites.Add(bullet4);
            sprites.Add(bullet5);
            sprites.Add(bullet6);
            sprites.Add(bullet7);
            sprites.Add(bullet8);
        }