/// <summary> /// 반원 배치로 2단계 탄 발사 /// </summary> private IEnumerator PatternD_2_HalfCirclePlaced() { // 반원 배치로 빠르게 진행하다가 하단으로 천천히 떨어짐 const float speed1 = 0.05f; const float speed2 = 0.01f; const int phase1Duration = 30; const int count = 12; const float angleRange = 100.0f / 360.0f; const float startAngleOffset = (angleRange / (float)(count - 1)) / 2.0f; const int interval = 20; const string shape = "Common/Bullet_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, this._X, this._Y, startAngle + angleRange * ((float)i / (count - 1) - 0.5f), speed1 , phase1Duration, 0.75f, speed2); } } yield return null; } }
IEnumerator SpawnObject() { while (true) { if (canShoot) { if (shotAngle >= 1) { shotAngle = 0; } shotAngle += shotCount * shotAngleRate; for (int i = 0; i < shotCount; i++) { tmp = spawnPool.Spawn(bullet, Vector3.zero, Quaternion.identity); tBullet = tmp.GetComponent <PlacedBullet> (); tmp.transform.position = tr.position; tBullet.speed = shotSpeed; tBullet.InitialSpeed = shotSpeed; tBullet.angle = shotAngle + (float)i / shotCount; tBullet.speedRate = 0; tBullet.angleRate = 0; tBullet.MoveTime = MoveTime; tBullet.StopTime = StopTime; tBullet.Timer = 0; tBullet.basicHP = bulletHp; tBullet.hp = bulletHp; tBullet.money = bulletMoney; } } yield return(new WaitForSeconds(shotDelay)); } }
private IEnumerator Pattern_PlacedCircleWave(bool bHalfAngleOffsetOnBlue, bool bSkipCircleHalf, float angleRate, int waveCount) { const float angle = 0.75f; const float speed1 = 0.03f; const float speed2 = 0.01f; const int phase1Duration = 30; const int bulletPerCircle = 40; const int circlePerWave = 7; const int circleInterval = 10; const int waveInterval = 12; for (int wave = 0; wave < waveCount; ++wave) { bool bBlue = wave % 2 == 0; string shape = bBlue ? "Common/Bullet_Blue" : "Common/Bullet_Red"; bool bHalfAngleOffset = bHalfAngleOffsetOnBlue ? bBlue : !bBlue; float angleStart = angle + ((bHalfAngleOffset) ? (1.0f / bulletPerCircle / 2.0f) : 0.0f); float waveAngleRate = bBlue ? angleRate : -angleRate; for (int circle = 0; circle < circlePerWave; ++circle) { for (int i = 0; i < bulletPerCircle; ++i) { float angle1 = angleStart + (1.0f / bulletPerCircle * i); bool bSkip = bSkipCircleHalf && (circle % 2 == 1); if (!bSkip) { PlacedBullet b = GameSystem._Instance.CreateBullet<PlacedBullet>(); b.Init(shape, _X, _Y , angle1, 0.0f, speed1, 0.0f , phase1Duration, 0 , angle1, waveAngleRate, speed2, 0.0f); } } yield return new WaitForFrames(circleInterval); } yield return new WaitForFrames(waveInterval); } }
public void ShootPlacedNWay(Vector2 pos, float angle, float angleRange, float speed, int count, int moveTime, int stopTime, GameObject bullet, int bulletMoney, float bulletHp) { for (int i = 0; i < count; i++) { tmp = spawnPool.Spawn(bullet); PlacedBullet tBullet = tmp.GetComponent <PlacedBullet> (); tmp.transform.position = pos; tBullet.angle = angle + angleRange * ((float)i / (count - 1) - 0.5f); tBullet.speed = speed; tBullet.InitialSpeed = speed; tBullet.MoveTime = moveTime; tBullet.StopTime = stopTime; tBullet.speedRate = 0; tBullet.angleRate = 0; tBullet.basicHP = bulletHp; tBullet.hp = bulletHp; tBullet.money = bulletMoney; } }
/// <summary> /// 이후 패턴을 위한 안전선 /// </summary> private 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 = "Common/Bullet_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); } }