IEnumerator AttackCor() { yield return(new WaitForSeconds(startDelay)); while (collider.enabled) { MathfFunc.RotateToPoint(Toolbox.Instance.handTransform.position, shotSpawn); if (monster.angry) { for (int i = 0; i < 10; i++) { angryBulletPool.Activate(shotSpawn.position, shotSpawn.rotation); yield return(new WaitForSeconds(0.1f)); } yield return(new WaitForSeconds(cdAngry)); } else { for (int i = 0; i < 5; i++) { normalBulletPool.Activate(shotSpawn.position, shotSpawn.rotation); yield return(new WaitForSeconds(0.1f)); } yield return(new WaitForSeconds(cdNormal)); } } }
void Update() { for (int i = 0; i < shotSpawns.Length; i++) { MathfFunc.RotateToPoint(Toolbox.Instance.handTransform.position, shotSpawns[i]); } }
IEnumerator AttackCor() { yield return(new WaitForSeconds(startDelay)); float lastAttackTime = Time.time; while (true) { MathfFunc.RotateToPoint(Toolbox.Instance.head.transform.position, pistol); if (Time.time > lastAttackTime + spawnCd) { source.PlayOneShot(shootSounds[Random.Range(0, shootSounds.Length)]); var obj = bulletPool.Activate(shotSpawn.position, shotSpawn.rotation); yield return(new WaitForSeconds(spawnCd + Random.Range(0f, 1f))); } else { yield return(null); } } }
IEnumerator AttackCor() { yield return(new WaitForSeconds(startDelay)); while (collider.enabled) { MathfFunc.RotateToPoint(Toolbox.Instance.handTransform.position, shotSpawn); if (monster.angry) { angryBulletPool.Activate(shotSpawn.position, shotSpawn.rotation); yield return(new WaitForSeconds(cdAngry)); } else { normalBulletPool.Activate(shotSpawn.position, shotSpawn.rotation); normalBulletPool.Activate(shotSpawn.position, Quaternion.Euler(shotSpawn.rotation.eulerAngles + new Vector3(0f, 0f, -15f))); normalBulletPool.Activate(shotSpawn.position, Quaternion.Euler(shotSpawn.rotation.eulerAngles + new Vector3(0f, 0f, 15f))); yield return(new WaitForSeconds(cdNormal)); } } }
IEnumerator AttackCor() { yield return(new WaitForSeconds(startDelay)); while (collider.enabled) { MathfFunc.RotateToPoint(Toolbox.Instance.handTransform.position, shotSpawn); if (monster.angry) { particle.Stop(); lineRend.enabled = true; float startTime = Time.time; while (Time.time - startTime < 2.5f) { lineRend.SetPosition(0, shotSpawn.position); lineRend.startColor = prepareColor; lineRend.endColor = prepareColor; var hit = Physics2D.Raycast(shotSpawn.position, shotSpawn.right, 25f, laserMask); if (hit) { lineRend.SetPosition(1, hit.point + (Vector2)shotSpawn.right * 0.1f); } else { lineRend.SetPosition(1, shotSpawn.position + shotSpawn.right * 35f); } yield return(null); } startTime = Time.time; particle.Play(); while (Time.time - startTime < 2.5f) { lineRend.startColor = attackColor; lineRend.endColor = attackColor; var hit = Physics2D.Raycast(shotSpawn.position, shotSpawn.right, 25f, laserMask); if (hit) { //lineRend.SetPosition(1, hit.point + (Vector2)shotSpawn.right * 0.1f); lineRend.SetPosition(1, hit.point); if (hit.collider.gameObject.CompareTag("Player")) { Toolbox.Instance.hand.GetDamage(damage); } } else { lineRend.SetPosition(1, shotSpawn.position + shotSpawn.right * 35f); } particle.transform.position = lineRend.GetPosition(1); //particle.transform.rotation = Quaternion.Euler shotSpawn.rotation.eulerAngles; yield return(null); } particle.Stop(); lineRend.enabled = false; yield return(new WaitForSeconds(cdAngry)); } else { for (int i = 0; i < 5; i++) { normalBulletPool.Activate(shotSpawn.position, shotSpawn.rotation); yield return(new WaitForSeconds(0.1f)); } yield return(new WaitForSeconds(cdNormal)); } } }