예제 #1
0
        private IEnumerator ShotTwo_CircleShot()
        {
            var winds = new WindArea[] { _fullScreeWindArea, _leftWindArea, _rightWindArea };

            while (true)
            {
                if (!_shotTwoShotCircleBullet)
                {
                    yield break;
                }

                float   angle  = Random.Range(0, 360);
                float   rad    = angle * Mathf.Deg2Rad;
                float   speed  = Random.Range(_shotTwoCirMinBulletSpeed, _shotTwoCirMaxBulletSpeed);
                Vector3 vSpeed = new Vector3(Mathf.Cos(rad), Mathf.Sin(rad), 0) * speed;

                var rotation = Quaternion.Euler(0, 0, angle - 90f);
                var bullet   = BulletUtils.GetBullet(
                    _shotTwoCirBullet, null, _falcon.position, rotation);
                bullet.GetComponent <JIBulletController> ()
                .Shot(WindBulletMove.LinearWindMove(bullet.transform, vSpeed, Vector3.zero, winds));

                float interval = Random.Range(_shotTwoCirMinEmitInterval, _shotTwoCirMaxEmitInterval);
                yield return(new WaitForSeconds(interval));
            }
        }
예제 #2
0
        private IEnumerator SidenWind_Shot()
        {
            var winds = new WindArea[] { _fullScreeWindArea, _leftWindArea, _rightWindArea };

            float timer      = 0f;
            float deltAngle  = _sideWindSecRange / _sideWindNumberPerSector;
            float startAngle = 270f - _sideWindSecRange / 2 + deltAngle / 2;

            for (int i = 0; i < _sideWindSecNumber; i++)
            {
                for (int j = 0; j < _sideWindNumberPerSector; j++)
                {
                    float      angle    = startAngle + deltAngle * j;
                    Quaternion rotation = Quaternion.Euler(0, 0, angle - 90f);

                    float   rad = angle * Mathf.Deg2Rad;
                    Vector3 vec = new Vector3(Mathf.Cos(rad), Mathf.Sin(rad), 0f) * _sideWindBulletVec;

                    var bullet = BulletUtils.GetBullet(
                        _sideWindBullet, null, _falcon.position, Quaternion.identity);
                    bullet.GetComponent <JIBulletController> ().Shot(
                        WindBulletMove.LinearWindMove(bullet.transform, vec, Vector3.zero, winds));
                }

                while (timer < _sideWindShotInterval)
                {
                    timer += JITimer.Instance.DeltTime;
                    yield return(null);
                }

                timer = 0f;
            }

            yield return(new WaitForSeconds(_fullWindWaitTimeWhenEndShot));
        }
예제 #3
0
        private void ShotOne_ShotBullet(float emitRad, Vector3 emitPos, WindArea[] winds)
        {
            var bulletRotate = Quaternion.Euler(0, 0, emitRad * Mathf.Rad2Deg);
            var bulletSpeed  = new Vector3(Mathf.Cos(emitRad), Mathf.Sin(emitRad), 0) * _shotOneBulletSpeed;
            var bullet       = BulletUtils.GetBullet(_shotOneBullet, null, emitPos, bulletRotate);

            bullet.GetComponent <JIBulletController> ()
            .Shot(WindBulletMove.LinearWindMove(bullet.transform, bulletSpeed, Vector3.zero, winds));
        }
예제 #4
0
        private void ShotThree_Shot()
        {
            var winds = new WindArea[] { _fullScreeWindArea, _leftWindArea, _rightWindArea };

            float delt = 360 / _shotThreeNumberPerCircle;

            for (int i = 0; i < _shotThreeNumberPerCircle; i++)
            {
                float   angle = i * delt;
                float   rad   = angle * Mathf.Deg2Rad;
                Vector3 speed = new Vector3(Mathf.Cos(rad), Mathf.Sin(rad), 0f) * _shotThreeInitVec;
                Vector3 accel = new Vector3(Mathf.Cos(rad), Mathf.Sin(rad), 0f) * _shotThreeAccel;

                var bullet = BulletUtils.GetBullet(
                    _shotThreeBullet, null, _falcon.position, Quaternion.identity);
                bullet.GetComponent <JIBulletController> ()
                .Shot(WindBulletMove.LinearWindMove(bullet.transform, speed, accel, winds));
            }
        }
예제 #5
0
        private IEnumerator ShotTwo_SecDirShot(float angle)
        {
            var   winds    = new WindArea[] { _fullScreeWindArea, _leftWindArea, _rightWindArea };
            float secRange = 60f;

            for (int i = 0; i < _shotTwoSecBulletNum; i++)
            {
                float   speed       = Random.Range(_shotTwoSecMinBulletSpeed, _shotTwoSecMaxBulletSpeed);
                float   bulletAngle = angle + Random.Range(-secRange / 2, secRange / 2);
                float   bulletRad   = bulletAngle * Mathf.Deg2Rad;
                Vector3 vSpeed      = new Vector3(Mathf.Cos(bulletRad), Mathf.Sin(bulletRad), 0) * speed;

                var rotation = Quaternion.Euler(0, 0, bulletAngle - 90f);
                var bullet   = BulletUtils.GetBullet(
                    _shotTwoSecBullet, null, _falcon.position, rotation);
                bullet.GetComponent <JIBulletController> ().Shot(
                    WindBulletMove.LinearWindMove(bullet.transform, vSpeed, Vector3.zero, winds));

                float interval = Random.Range(_shotTwoSecMinEmitInterval, _shotTwoSecMaxEmitInterval);
                yield return(new WaitForSeconds(interval));
            }
        }