private IEnumerator Shoot() { while (true) { int count = 0; while (count < attackCount) { count++; Vector3 dest = Lect.RandomPosOnCenter(player.position, 0f, 2f); line.enabled = true; line.SetPosition(1, dest + Vector3.up * 5f); if (Vector3.Distance(player.position, dest) < 0.5f) { //맞았을 경우 대미지 if (!playerHit.IsInvincible) { playerHUD.DecreaseHp(damage); //playerHit.FrontBackCheck(player, transform); //playerHit.GunHit(1); if (Flat.Instance.GetGround()) { playerHit.BeHitGun(); } else { playerHit.BeHitAir(); } } } float val2 = 1f; while (val2 > 0f) { line.SetPosition(0, transform.position); val2 -= Time.fixedDeltaTime * attackSpeed; line.startWidth = val2; line.endWidth = val2; yield return(new WaitForFixedUpdate()); } line.enabled = false; } yield return(new WaitForSeconds(Mathf.Abs(attackCycle))); } }
public void RailGunEffect() { if (!playerHit.IsInvincible) { Vector3 origin = muzzle.position; Vector3 dest = boss.transform.forward; //playerCenter = player.GetComponent<BoxCollider>().bounds.center; //Vector3 dir = (playerCenter - muzzle.position).normalized; if (Physics.Raycast(origin, dest, out hit, 200f, 1 << 9 | 1 << 13, QueryTriggerInteraction.Ignore)) { StartCoroutine(RangeLine(origin, hit.point)); GameObject effect1 = ObjectPool.Instance.PopFromPool("RailBoom"); //GameObject effect2 = ObjectPool.Instance.PopFromPool("GatlingBoom"); effect1.transform.position = hit.point; //effect2.transform.position = hit.point; effect1.SetActive(true); //effect2.SetActive(true); if (hit.transform.CompareTag("Player")) { playerHUD.DecreaseHp(rangeDamage); playerHit.FrontBackCheck(player, boss); playerHit.GunHit(1); if (Flat.Instance.GetGround()) { playerHit.BeHitGun(); } else { playerHit.BeHitAir(); } } } else { StartCoroutine(RangeLine(origin, dest * 200f)); } } }