// Use this for initialization void Start() { //子オブジェクト取得 hpGage = transform.FindChild("hpGage").gameObject.GetComponent <Image>(); redGage = transform.FindChild("redGage").gameObject.GetComponent <Image>(); //親オブジェクト取得 parent = transform.root.gameObject; try { waveManagement = GameObject.Find("Wave").GetComponent <yWaveManagement>(); } catch (Exception e) { print("見つからない"); } //要はEnemyの時 if (parent.name != "Canvas") { //Enemyの時、親オブジェクトのスクリプトを取得 enemyManager = parent.GetComponent <yEnemyManager>(); hp = enemyManager.EnemyHP; } maxHP = hp; }
IEnumerator BossAppearance() { yield return(new WaitUntil(() => flgBoss)); //flgBossがtrueになったとき yield return(new WaitForSeconds(1.0f)); //1.0秒待つ //yield return StartCoroutine("BossPerformance");//ボスが出てくる演出 yield return(new WaitForSeconds(enemyAppearanceTime[i]));//ボス出現 SpriteRenderer boss; for (int k = 0; k < enemyType.Length; k++) { if (enemyID[i] == enemyType[k].name) { boss = Instantiate(enemyType[k], enemyPos[i], Quaternion.identity) as SpriteRenderer; boss.name = enemyID[i]; enemyManager = boss.GetComponent <yEnemyManager>(); enemyManager.EnemyHP = enemyHP[i]; break; } } //yield return StartCoroutine("BossPerformanceText");//ボス出現のテキスト yield break; }
void Start() { spr = GetComponent <SpriteRenderer>(); spr.color = new Color(spr.color.r, spr.color.g, spr.color.b, alpha); enemyManager = transform.parent.GetComponent <yEnemyManager>(); waveManagement = GameObject.Find("Wave").GetComponent <yWaveManagement>(); parent = transform.root.gameObject; }
// Use this for initialization void Start() { particle = Resources.Load("yResources/particle") as GameObject; //子オブジェクト取得 hpGage = transform.FindChild("hpGage").gameObject.GetComponent <Image>(); redGage = transform.FindChild("redGage").gameObject.GetComponent <Image>(); //親オブジェクト取得 parent = transform.root.gameObject; waveManagement = GameObject.Find("Wave").GetComponent <yWaveManagement>(); vFade = Camera.main.GetComponent <yVignetteFade>(); //要はEnemyの時 if (parent.tag == "enemy") { //Enemyの時、親オブジェクトのスクリプトを取得 enemyManager = parent.GetComponent <yEnemyManager>(); hp = enemyManager.EnemyHP; } maxHP = hp; }
// Update is called once per frame void Update() { time += Time.deltaTime; print(flgNumber); if (waveNumber < 3)//ボス戦前のWave数まで { if (flgNumber && j < 2) { if (time >= enemyAppearanceTime[i])//時間になったら生成 { while (true) { for (int k = 0; k < enemyType.Length; k++) { if (enemyID[i] == enemyType[k].name) { SpriteRenderer enemy; enemy = Instantiate(enemyType[0], enemyPos[i], Quaternion.identity) as SpriteRenderer; enemy.name = enemyID[i] + number; enemyManager = enemy.GetComponent <yEnemyManager>(); enemyManager.EnemyHP = enemyHP[i]; break; } } i++; number--; if (i >= wholeNumber)//全ての敵が出現し終えたら(1~3Wave) { break; } else if (enemyAppearanceTime[i - 1] == enemyAppearanceTime[i])//今作ったものと次作る秒数が一緒っだったらもう一度 { continue; } else { break; } } } } if (number <= 0)//そのWaveに出てくる敵の出現がなくなったら { flgNumber = false; } if (enemyNumber[j] <= 0 && j < 2)//そのWaveの敵が全て死んだら { waveNumber++; time = 0; if (j < 1) { j++; } else { flgBoss = true; } number = enemyNumber[j]; flgNumber = true; } } //if (Input.GetKeyDown(KeyCode.A)) // yMusicManager.instance.MusicSound((int)yMusicManager.musicChip.bgm1); }
// Update is called once per frame void Update() { if (_time.FlgTime) { time += Time.deltaTime; } print(enemyNumber[j]); if (waveNumber < maxWave)//ボス戦前のWave数まで { if (flgNumber && j < maxWave - 1) { if (time >= enemyAppearanceTime[i]) //時間になったら生成 { while (true) //同じ時間に敵が出るとき同時生成する { for (int k = 0; k < enemyType.Length; k++) { if (enemyID[i] == enemyType[k].name) { SpriteRenderer enemy; enemy = Instantiate(enemyType[k], enemyPos[i], Quaternion.identity) as SpriteRenderer; enemy.name = enemyID[i] + number; enemyManager = enemy.GetComponent <yEnemyManager>(); enemyManager.EnemyHP = enemyHP[i]; break; } } i++; number--; if (i >= wholeNumber)//全ての敵が出現し終えたら(1~3Wave) { break; } else if (enemyAppearanceTime[i - 1] == enemyAppearanceTime[i] && number > 0)//今作ったものと次作る秒数が一緒だったらもう一度 { continue; } else { break; } } } } if (number <= 0)//そのWaveに出てくる敵の出現がなくなったら { flgNumber = false; } if (enemyNumber[j] <= 0 && j < maxWave - 1)//そのWaveの敵が全て死んだら { waveNumber++; time = 0; if (j < maxWave - 1) { bandFade.FlgFadeIn = true; } if (j < maxWave - 2) { j++; bandFade.FlgFadeIn = true; } else { flgBoss = true; } number = enemyNumber[j]; flgNumber = true; } } //if (Input.GetKeyDown(KeyCode.A)) // yMusicManager.instance.MusicSound((int)yMusicManager.musicChip.bgm1); //if (Input.GetKeyDown(KeyCode.B)) // Sound((int)soundClip.se1); //if (Input.GetKeyDown(KeyCode.C)) // Sound((int)soundClip.se2); //if (Input.GetKeyDown(KeyCode.D)) // Sound((int)soundClip.se3); //if (Input.GetKeyDown(KeyCode.Space)) // MusicEffectStop(); if (enemyNumber[2] == 0) { vFade.NextScene = "GameClear"; vFade.FlgFadeOut = true; } }