public void Repeat(RepeatParam param) { mIsFiring = true; if(!mIsRepeatActive) { mIsRepeatActive = true; StartCoroutine(DoShoot(param)); } }
private IEnumerator DoShoot(RepeatParam param) { while(mIsFiring) { Vector2 p = param.source != null ? param.source.position : transform.position; float damageMod = param.sourceStat != null ? param.sourceStat.damageMod : 0.0f; p += param.ofs; if(useUpVector) { Shoot(p, transform.up, damageMod, param.seek); } else { Shoot(p, param.dir, damageMod, param.seek); } yield return new WaitForSeconds(delayPerShot); } mIsRepeatActive = false; yield break; }