Пример #1
0
        private int _patternDPartDuration = 60 * 14;    // 패턴 D의 파트별 지속시간
        public IEnumerator Pattern_08(Mover mover)
        {
            // 안전선 발사
            PatternD_2_SafetyLine();
            // 보스 기준위치로 이동
            yield return(StartCoroutine(MoveConstantVelocity(mover, new Vector2(0.0f, 0.75f), 240)));

            yield return(new WaitForFrames(240));

            // 반원 발사
            const float  speed1           = 0.05f;
            const float  speed2           = 0.01f;
            const int    phase1Duration   = 30;
            const int    count            = 5;
            const float  angleRange       = 100.0f / 360.0f;
            const float  startAngleOffset = (angleRange / (float)(count - 1)) / 2.0f;
            const int    interval         = 30;
            const string shape            = BulletName.blue;

            for (int frame = 0; frame < (_patternDPartDuration / 2); ++frame)
            {
                if (frame % interval == 0)
                {
                    float startAngle = 0.75f + GameSystem._Instance.GetRandomRange(-startAngleOffset, startAngleOffset);
                    for (int i = 0; i < count; ++i)
                    {
                        PlacedBullet b = GameSystem._Instance.CreateBullet <PlacedBullet>();
                        b.InitNoStop(shape, mover._X, mover._Y, startAngle + angleRange * ((float)i / (count - 1) - 0.5f), speed1
                                     , phase1Duration, 0.75f, speed2);
                    }
                }
                yield return(null);
            }
        }
Пример #2
0
        public IEnumerator Shot(Mover mover)
        {
            float angleStart = angle + ((halfAngleOffset) ? (1.0f / count / 2.0f) : 0.0f);

            for (int i = 0; i < count; ++i)
            {
                PlacedBullet b = GameSystem._Instance.CreateBullet <PlacedBullet>();
                b.Init(BulletName.blue, mover._X, mover._Y, angleStart + (1.0f / count * i), speed, moveDuration, stopDuration, angle2, speed2);
            }
            yield return(null);
        }
Пример #3
0
        /// <summary>
        /// 설치 원형탄
        /// </summary>
        public void PlacedCircleBullet(Mover mover, string shape, float angle, float speed, int count, bool halfAngleOffset
                                       , int moveDuration, int stopDuration, float angle2, float speed2)
        {
            float angleStart = angle + ((halfAngleOffset) ? (1.0f / count / 2.0f) : 0.0f);

            for (int i = 0; i < count; ++i)
            {
                PlacedBullet b = GameSystem._Instance.CreateBullet <PlacedBullet>();
                b.Init(shape, mover._X, mover._Y, angleStart + (1.0f / count * i), speed, moveDuration, stopDuration, angle2, speed2);
            }
        }
Пример #4
0
        public override void Move()
        {
            // 탄도 상의 각도와 반경으로 슈터 좌표 설정
            float rad = _orbitAngle * Mathf.PI * 2.0f;

            _X = Mathf.Cos(rad) * _orbitRadius;
            _Y = Mathf.Sin(rad) * _orbitRadius;

            // 탄도 상의 각도 갱신
            _orbitAngle += _orbitAngleRate;
            _orbitAngle -= Mathf.Floor(_orbitAngle);

            // 화면 바깥쪽을 향해서 방향탄 발사
            if (_time % 5 == 0)
            {
                Bullet b = GameSystem._Instance.CreateBullet <Bullet>();
                b.Init(_bulletShape, _X, _Y, _orbitAngle, 0.0f, _bulletSpeed * 1.5f, 0.0f);
            }

            // 설치탄 발사
            int   count    = _time / (_shotTime + _waitTime);             // 그룹 번호
            int   time     = _time % (_shotTime + _waitTime);             // 그룹 내 시간
            float baseTime = (_orbitRadius - _playerSize) / _bulletSpeed; // 탄이 화면 중앙에 도달할 때 까지의 시간

            // 지정돤 그룹 수만큼 반복
            if (count < _groupCount)
            {
                // 발사 시간만큼 정해진 간격으로 탄 발사
                if ((time < _shotTime) && (time % _interval == 0))
                {
                    // 설치탄 생성
                    // 나중에 쏜 탄일수록 화면 중앙에 가깝게 함
                    PlacedBullet b = GameSystem._Instance.CreateBullet <PlacedBullet>();
                    b.Init(_bulletShape, _X, _Y, _orbitAngle + 0.5f, _bulletSpeed
                           , (int)(baseTime * count / _groupCount)
                           , (int)(baseTime + (_shotTime + _waitTime) * (_groupCount - count)));
                }
            }

            // 타이머 갱신
            _time = (_time + 1) % _cycle;

            // 삭제는 외부에서 지정
        }
Пример #5
0
        // sup
        /// 이후 패턴을 위한 안전선
        public void PatternD_2_SafetyLine()
        {
            const float  speed1         = 0.0045f;
            const float  speed2         = 0.01f;
            const int    phase1Duration = 480;
            const int    count          = 10;
            const string shape          = BulletName.red;

            float startX = GameSystem._Instance._MinX;
            float gapX   = (GameSystem._Instance._MaxX - GameSystem._Instance._MinX) / (count - 1);
            float y      = GameSystem._Instance._MaxY;

            for (int i = 0; i < count; ++i)
            {
                // 아래로 내려오다가
                // 페이즈 2 때 절반은 왼쪽으로, 절반은 오른쪽으로 사라짐
                PlacedBullet b = GameSystem._Instance.CreateBullet <PlacedBullet>();
                b.InitNoStop(shape, startX + (i * gapX), y, 0.75f, speed1
                             , phase1Duration, (i < (count / 2) ? 0.5f : 0.0f), speed2);
            }
        }