예제 #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 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));
            }
        }
예제 #4
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));
            }
        }
예제 #5
0
        private IEnumerator ShotOne_ShotEmitter()
        {
            var winds = new WindArea[] { _fullScreeWindArea, _leftWindArea, _rightWindArea };

            var emitterOne = Instantiate(_shotOneEmitter, _falcon.position, Quaternion.identity);
            var emitterTwo = Instantiate(_shotOneEmitter, _falcon.position, Quaternion.identity);

            float emitOneRad = 0;
            float emitTwoRad = Mathf.PI;

            Vector3 emitOnePos = new Vector3(Mathf.Cos(emitOneRad), Mathf.Sin(emitOneRad), 0) *
                                 _shotOneCircleRadius + _falcon.position;
            Vector3 emitTwoPos = new Vector3(Mathf.Cos(emitTwoRad), Mathf.Sin(emitTwoRad), 0) *
                                 _shotOneCircleRadius + _falcon.position;

            float movTimer = 0f;
            float shoTimer = 0;

            // Move emitters to the start of the circle
            while (movTimer < 0.5f)
            {
                movTimer += JITimer.Instance.DeltTime;
                emitterOne.transform.position = Vector3.Lerp(_falcon.position, emitOnePos, movTimer / 0.5f);
                emitterTwo.transform.position = Vector3.Lerp(_falcon.position, emitTwoPos, movTimer / 0.5f);
                yield return(null);
            }
            movTimer = 0f;

            // Move emitters around the boss
            while (movTimer < _shotOneCircleMoveTime)
            {
                movTimer += JITimer.Instance.DeltTime;
                shoTimer += JITimer.Instance.DeltTime;

                emitOneRad = movTimer * _shotOneCircleMoveSpeed;
                emitTwoRad = Mathf.PI - movTimer * _shotOneCircleMoveSpeed;

                emitOnePos = new Vector3(Mathf.Cos(emitOneRad), Mathf.Sin(emitOneRad), 0) *
                             _shotOneCircleRadius + _falcon.position;
                emitTwoPos = new Vector3(Mathf.Cos(emitTwoRad), Mathf.Sin(emitTwoRad), 0) *
                             _shotOneCircleRadius + _falcon.position;

                emitterOne.transform.position = emitOnePos;
                emitterTwo.transform.position = emitTwoPos;

                if (shoTimer > _shotOneShotInterval - 0.01f)
                {
                    ShotOne_ShotBullet(emitOneRad, emitOnePos, winds);
                    ShotOne_ShotBullet(emitTwoRad, emitTwoPos, winds);
                    shoTimer = 0;
                }

                yield return(null);
            }

            Destroy(emitterOne);
            Destroy(emitterTwo);

            yield return(new WaitForSeconds(0.5f));

            ShotOne_Transition();
        }