// Update is called once per frame void Update() { //一回だけ if (PLSenser.GetPL_Search() && !SpawnStart) { StartCoroutine(Monstar_Spawn()); SpawnStart = true; } }
private IEnumerator ShotAction(GameObject target) { NowCoroutine = ShotAction(target); Sensor = PlayerSensor.GetComponent <PlayerSensor>(); //targetが感知範囲から出た時にShootingがのtreuときfalseにしてwhile抜ける while (Sensor.GetPL_Search() && GetShooting()) { // if (target.GetComponent<Character>().HP <= 0) //{ break; } //弾を生成する GameObject Bullets = Instantiate(Bullet, transform.position, Quaternion.identity); //弾に初速を与える Bullets.GetComponent <Rigidbody>().AddForce(transform.forward * ShotSpeed, ForceMode.Impulse); Bullets.AddComponent <AttackArea>(); Bullets.GetComponent <AttackArea>().aligment = aligment.enemy; Bullets.GetComponent <AttackArea>().DestroyCheck = character.DamageObjDestroy; Bullets.GetComponent <AttackArea>().Damage = Damage; //判別用のタグをつける Bullets.tag = Tags.Magic; //WaitTimeの間、待って再度実行する yield return(new WaitForSeconds(WaitTime)); } SetCoroutineReset(); offShooting(); }
void Update() { if (Time.timeScale == 0) { return; } if (stop) { Action.StopCoroutines(); return; } //諸々の状態異常効果の反映 if (abnManager.isDeath(this)) { Death(); return; } abnManager.TimeCheck(Time.deltaTime); float dot = abnManager.DotDamage(this, Time.deltaTime); if (dot != 0) { GetDamage(dot, transform.position); } //状態異常による行動不能の確認 状態異常の時間経過処理をした後に確認 if (!abnManager.isAction(this)) { if (Action) { Action.StopCoroutines(); } return; } //前のフレームで停止状態だったなら、いろいろ初期化する else if (abnManager.IsActionStopStateEnd()) { Action.PauseEnd(); return; } if (Sensor && Sensor.GetPL_Search()) { if (PLController.HP <= -1) { Action.PlayerDeathStop(); } Action.ActionEnter(PC, gameObject); } }
private IEnumerator ShotAction(GameObject target) { NowCoroutine = ShotAction(target); Sensor = PlayerSensor.GetComponent <PlayerSensor>(); //targetが感知範囲から出た時にShootingがのtreuときfalseにしてwhile抜ける while (Sensor.GetPL_Search() && GetShooting()) { // if (target.GetComponent<Character>().HP <= 0) //{ break; } if (!shootStop) { shootStop = true; //弾を生成する GameObject Bullets = Instantiate(Bullet, transform.position, Quaternion.identity); //弾に初速を与える Bullets.GetComponent <Rigidbody>().AddForce(transform.forward * ShotSpeed, ForceMode.Impulse); Bullets.AddComponent <AttackArea>(); Bullets.GetComponent <AttackArea>().aligment = aligment.enemy; Bullets.GetComponent <AttackArea>().DestroyCheck = character.DamageObjDestroy; Bullets.GetComponent <AttackArea>().Damage = Damage.GetValue(); //判別用のタグをつける Bullets.tag = Tags.Magic; SEManager.SetSE(MagicSystemManager.instance.SEManager.mizugorowaShot); } //WaitTimeの間、待って再度実行する //yield return new WaitForSeconds(WaitTime); while (CoolTime <= WaitTime.GetValue()) { yield return(null); CoolTime += Time.deltaTime; } shootStop = false; CoolTime = 0; } SetCoroutineReset(); offShooting(); }
void Update() { if (stop) { Action.StopCoroutines(); return; } //諸々の状態異常効果の反映 if (abnManager.isDeath(this)) { Death(); return; } abnManager.TimeCheck(Time.deltaTime); float dot = abnManager.DotDamage(this, Time.deltaTime); if (dot != 0) { GetDamage(dot); } //状態異常による行動不能の確認 状態異常の時間経過処理をした後に確認 if (!abnManager.isAction(this)) { Debug.Log("stop state"); if (Action) { Action.StopCoroutines(); } return; } if (Sensor && Sensor.GetPL_Search()) { if (PLController.HP <= -1) { Action.PlayerDeathStop(); } Action.ActionEnter(PC, gameObject); } }