public G20_Enemy EnemyPop(G20_EnemyType enemyType, Vector3 position, G20_EnemyPopType popType = G20_EnemyPopType.RISE_UP) { // 敵のオブジェクト生成 var ene = popEnemySelector.GetPopEnemy(enemyType); ene.transform.SetParent(transform.parent); G20_SEManager.GetInstance().Play(G20_SEType.SUMMON_APPLE, position + new Vector3(0, 0.02f, 0)); // 出現演出 switch (popType) { case G20_EnemyPopType.RISE_UP: //敵の召喚エフェクト生成(少し魔法陣を浮かす) G20_EffectManager.GetInstance().Create(G20_EffectType.SUMMON_APPLE, position + new Vector3(0, 0.02f, 0)); ene.transform.position = position + new Vector3(0, riseUpDifY, 0); StartCoroutine(RiseUp(ene)); break; case G20_EnemyPopType.WALK_FORWARD: G20_EffectManager.GetInstance().Create(G20_EffectType.SUMMON_APPLE_VERT, position); position.y = 0f; ene.transform.position = position + new Vector3(0, 0, walkForwardDifZ); StartCoroutine(WalkForward(ene)); break; } var enemy = ene.GetComponent <G20_Enemy>(); //enemyのbuffを設定 G20_EnemyBuff enemy_buff = null; if (onPopSpeedBuffValue != 0) { enemy_buff = new G20_SpeedBuff(enemy, 100.0f, onPopSpeedBuffValue); } if (enemy_buff != null) { enemy.AddBuff(enemy_buff); } // 敵情報保存 G20_EnemyCabinet.GetInstance().RegisterEnemy(enemy); //敵情報破棄を敵が死んだときに実行 enemy.OnDestroyAction += G20_EnemyCabinet.GetInstance().UnregisterEnemy; return(enemy); }
void SequenceUpdate() { // Enemyをポップするかの判定 var nowStatus = popSequenceList[sequenceCounter]; if ((nowStatus.sequencePopType == SequencePopType.PATERN || (nowStatus.sequencePopType == SequencePopType.CUE && popCueList.Count > 0)) && popTimer >= nowStatus.popIntervalTime && enemyCabinet.enemyCount < nowStatus.limitEnemyCount) { popTimer = 0.001f; int popCount = nowStatus.popEnemyCountByOneChance; List <int> poppedNumberList = new List <int>(); while (popCount > 0 && enemyCabinet.enemyCount < nowStatus.limitEnemyCount) { if (nowStatus.sequencePopType == SequencePopType.CUE && popCueList.Count <= 0) { // キューが出尽くしている break; } PopEnemyCue cue = new PopEnemyCue(); switch (nowStatus.sequencePopType) { case SequencePopType.CUE: // キューの先頭から抜き出す cue = popCueList[0]; popCueList.RemoveAt(0); break; case SequencePopType.PATERN: switch (nowStatus.popPaternType) { case PopPaternType.PATERN_A: cue = paternA.cueList[paternCueCounter]; paternCueCounter++; if (paternCueCounter >= paternA.cueList.Length) { paternCueCounter = 0; } break; case PopPaternType.PATERN_B: cue = paternB.cueList[paternCueCounter]; paternCueCounter++; if (paternCueCounter >= paternB.cueList.Length) { paternCueCounter = 0; } break; case PopPaternType.PATERN_C: cue = paternC.cueList[paternCueCounter]; paternCueCounter++; if (paternCueCounter >= paternC.cueList.Length) { paternCueCounter = 0; } break; case PopPaternType.PATERN_D: cue = paternD.cueList[paternCueCounter]; paternCueCounter++; if (paternCueCounter >= paternD.cueList.Length) { paternCueCounter = 0; } break; case PopPaternType.PATERN_E: cue = paternE.cueList[paternCueCounter]; paternCueCounter++; if (paternCueCounter >= paternE.cueList.Length) { paternCueCounter = 0; } break; case PopPaternType.PATERN_F: cue = paternF.cueList[paternCueCounter]; paternCueCounter++; if (paternCueCounter >= paternF.cueList.Length) { paternCueCounter = 0; } break; case PopPaternType.PATERN_G: cue = paternG.cueList[paternCueCounter]; paternCueCounter++; if (paternCueCounter >= paternG.cueList.Length) { paternCueCounter = 0; } break; case PopPaternType.PATERN_H: cue = paternH.cueList[paternCueCounter]; paternCueCounter++; if (paternCueCounter >= paternH.cueList.Length) { paternCueCounter = 0; } break; default: break; } break; default: break; } popCount--; int positionNumber = 0; //0以下だったらランダム処理 if (cue.positionNumber <= 0) { int minNum = 0; int maxNum = 0; SetMinMAx(cue.positionNumber, out minNum, out maxNum); positionNumber = GetRandomPopNumber(poppedNumberList, minNum, maxNum); } else { positionNumber = cue.positionNumber - 1; } if (positionNumber < 0 || popPositions.Length - 1 < positionNumber) { Debug.LogError("ポップ位置の選択が不正"); } Vector3 _popPos = popPositions[positionNumber].transform.position; poppedNumberList.Add(positionNumber); G20_EnemyPopType popType = G20_EnemyPopType.RISE_UP; if (positionNumber <= 19) { popType = G20_EnemyPopType.RISE_UP; } else if (20 <= positionNumber && positionNumber <= 23) { popType = G20_EnemyPopType.WALK_FORWARD; } // 敵出現 var enemy = enemyPopper.EnemyPop(cue.enemyType, _popPos, popType); if (sequenceCounter == 0) { // 最初の敵にはチュートリアル的なターゲットサークルを出す var eff = G20_EffectManager.GetInstance().Create(G20_EffectType.TARGETING_LINE, enemy.Head.position); eff.transform.parent = enemy.Head; enemy.deathActions += (a, b) => Destroy(eff); } // 同時に試しにステージ脇リンゴ生成 //G20_ScoreApplePopper.GetInstance().PopSameAppleWithEnemy(cue.enemyType); // スピードバフ G20_SpeedBuff speedBuff = null; if (nowStatus.speedBuffValue != 0) { speedBuff = new G20_SpeedBuff(enemy, 100.0f, nowStatus.speedBuffValue); } if (speedBuff != null) { enemy.AddBuff(speedBuff); } } } }