Esempio n. 1
0
        // Update is called once per frame
        void Update()
        {
            float delta = (360.0f / numBullets);

            counter += Time.deltaTime;
            if (counter > duration)
            {
                counter -= duration;

                for (int i = 1; i <= numBullets; i++)
                {
                    float angle;
                    if (b)
                    {
                        angle = i * delta + (delta / 2);
                    }
                    else
                    {
                        angle = i * delta;
                    }
                    BaseBullet.Create(Bullet, transform.position, angle);
                }
                b = !b;
            }
        }
Esempio n. 2
0
    void Shoot()
    {
        for (int nAngle = 0; nAngle <= 180; nAngle += 10)
        {
            m_cCreateBullet = Instantiate(m_cBulletPrefab);
            m_cCreateBullet.transform.parent = m_cBulletParent;
            m_scBaseBullet = m_cCreateBullet.GetComponent <BaseBullet>();

            Quaternion stRotation = m_cGun.rotation;
            m_cGun.Rotate(new Vector3(0f, 0f, -90f + nAngle + m_nCircleState));

            m_scBaseBullet.Create(m_cGun.position, m_cGun.rotation,
                                  new Vector3(1f, 1.5f),
                                  1, 10f, transform.tag);
            m_cGun.rotation = stRotation;
        }
        if (m_bCircleState == true)
        {
            if (m_nCircleState == 0)
            {
                m_nCircleState = 15;
            }
            else if (m_nCircleState == 15)
            {
                m_nCircleState = -15;
            }
            else if (m_nCircleState == -15)
            {
                m_nCircleState = 0;
            }
        }
    }
Esempio n. 3
0
    void Shoot()
    {
        m_cCreateBullet = Instantiate(m_cBulletPrefab);
        m_cCreateBullet.transform.parent = m_cBulletParent;
        m_scBaseBullet = m_cCreateBullet.GetComponent <BaseBullet>();

        m_scBaseBullet.Create(m_cGun.position, m_cGun.rotation,
                              new Vector3(1f, 1.5f),
                              1, 10f, transform.tag);
    }
Esempio n. 4
0
        // Update is called once per frame
        void Update()
        {
            counter += Time.deltaTime;
            if (counter > duration)
            {
                counter -= duration;

                BaseBullet.Create(Bullet, transform.position, lastAngle);
                lastAngle += delta;
            }
        }
Esempio n. 5
0
        // Update is called once per frame
        void Update()
        {
            var p = Player.Instance.transform;

            Vector2 pos = p.position;


            Vector2 enemyPosition = gameObject.transform.position;

            Vector2 diff = enemyPosition - pos;

            float diffAngle = diff.GetAngle() * Mathf.Rad2Deg + 180;

            float delta = 10.0f;


            counter += Time.deltaTime;
            if (counter > duration)
            {
                counter -= duration;

                /*
                 * if (diffAngle > 360)
                 * {
                 *  diffAngle -= 360;
                 * }
                 * if (diffAngle < 0)
                 * {
                 *  diffAngle += 360;
                 * } */

                //BaseBullet.Create(Bullet, transform.position, diffAngle);
                for (int i = 0; i < numBullets; i++)
                {
                    var d = (numBullets - 1) / 2.0f;
                    var o = (i * offset) - d * offset;
                    BaseBullet.Create(Bullet, transform.position, diffAngle + o);
                }

                /*for (int i = 1; i <= 3; i++)
                 * {
                 *  BaseBullet.Create(Bullet, transform.position, diffAngle);
                 *
                 *
                 *
                 *
                 * } */
            }
        }
Esempio n. 6
0
        // Update is called once per frame
        void Update()
        {
            var p = Player.Instance.transform;

            Vector2 pos = p.position;


            Vector2 enemyPosition = gameObject.transform.position;

            Vector2 diff = enemyPosition - pos;

            float diffAngle = diff.GetAngle() * Mathf.Rad2Deg + 180;

            float delta         = (360.0f / numBullets);
            float angleToPlayer = Mathf.Atan2(p.transform.position.y, p.transform.position.x) * Mathf.Rad2Deg;

            counter += Time.deltaTime;
            if (counter > duration)
            {
                counter -= duration;

                /*
                 * if (diffAngle > 360)
                 * {
                 *  diffAngle -= 360;
                 * }
                 * if (diffAngle < 0)
                 * {
                 *  diffAngle += 360;
                 * } */
                if (b)
                {
                    BaseBullet.Create(firstBullet, transform.position, diffAngle);
                }



                else
                {
                    float angle = 0.0f;
                    for (int i = 1; i <= numBullets; i++)
                    {
                        BaseBullet.Create(Bullet, transform.position, angle);
                        angle += delta;
                    }
                }
                b = !b;
            }
        }
Esempio n. 7
0
    void Shoot()
    {
        for (int nIndex = -1; nIndex < 2; nIndex++)
        {
            m_cCreateBullet = Instantiate(m_cBulletPrefab);
            m_cCreateBullet.transform.parent = m_cBulletParent;
            m_scBaseBullet = m_cCreateBullet.GetComponent <BaseBullet>();

            m_scBaseBullet.Create(
                new Vector3(m_cGun.position.x + (nIndex / 3f), m_cGun.position.y, m_cGun.position.z),
                m_cGun.rotation,
                new Vector3(1f, 1.5f),
                1, 10f, transform.tag);
        }
    }
Esempio n. 8
0
        // Update is called once per frame
        void Update()
        {
            float delta = 10.0f;

            counter += Time.deltaTime;
            if (counter > duration)
            {
                counter -= duration;

                for (int i = 1; i <= 10; i++)
                {
                    BaseBullet.Create(Bullet, transform.position, lastAngle);
                    lastAngle += delta;
                }
            }
        }
Esempio n. 9
0
    // Update is called once per frame
    void Update()
    {
        float delta = (360f / numBullets);

        counter += Time.deltaTime;
        if (counter > duration)
        {
            counter = float.NegativeInfinity;

            for (int i = 1; i <= numBullets; i++)
            {
                float angle = i * delta;
                BaseBullet.Create(Bullet, transform.position, angle);
            }
        }
    }
Esempio n. 10
0
 void shootsBullet(float angle)
 {
     BaseBullet.Create(Bullet, transform.position, angle);
 }