コード例 #1
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);
        }
コード例 #2
0
ファイル: BaseGameLogic.cs プロジェクト: bmjoy/ShootingBeats
        /// <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);
            }
        }
コード例 #3
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;

            // 삭제는 외부에서 지정
        }