private IEnumerator Shoot() { while (enemies.Count > 0) { Bomber b = enemies.Pop(); do { if (b == null) { break; } yield return(new WaitForSeconds(CoolDown)); if (b == null || Vector3.Distance(transform.position, b.transform.position) > range) { break; } float pooptimer = 0; while (pooptimer < fireRate) { if (b == null) { break; } weapon.PointAt(b.transform.position); pooptimer += Time.deltaTime; yield return(null); } weapon.Retract(); } while (!b.TryKill(Damage())); } }
private void ThrustCheck() { if (stopInput || dead) { return; } if (Input.anyKey) { if (!buttonPressed) { buttonPressed = true; Tile t = Level.MapTile(gameObject); if (Safe(t)) { pillar = t.Pillar.transform.position; pullPoint = t.PullPoint.transform.position; deltaAngle = 0; deltaAngleAction = 0; lastDirToPillar = pillar - transform.position; GetHeading = CalculateHeading(pullPoint); rb.AddForce(GetHeading(pullPoint).normalized *Acceleration *4, ForceMode.Acceleration); } } Vector3 dir = GetHeading(pullPoint); holdTimer += Time.deltaTime; if (holdTimer >= thrustTime && !actionPerformed) { rb.AddForce(dir.normalized * Acceleration, ForceMode.Acceleration); GrappleObject.PointAt(pullPoint); AutoGrapple.Retract(); } } else { if (buttonPressed) { if (holdTimer < thrustTime) { print("press"); } holdTimer = 0; deltaAngle = 0; deltaAngleAction = 0; buttonPressed = false; actionPerformed = false; GrappleObject.Retract(); } } }
private void UpdateShot(float timer) { if (timer > ShootTime) { AckwireTarget(); } else { laser.PointAt(target.position); } }
private IEnumerator TempPullAnimate(float seconds) { float pooptimer = 0; while (pooptimer < seconds) { AutoGrapple.PointAt(pullPoint); pooptimer += Time.deltaTime; yield return(null); } AutoGrapple.Retract(); }
private IEnumerator Shoot(float seconds) { float wait = seconds / 3; Vector3 target = ShootPoint(); weapon.PointAt(target + Offset()); yield return(new WaitForSeconds(wait)); weapon.PointAt(target + Offset()); yield return(new WaitForSeconds(wait)); weapon.PointAt(target + Offset()); yield return(new WaitForSeconds(wait)); weapon.Retract(); if (Target.TryKill(damage)) { attacking = false; StopAllCoroutines(); StartCoroutine(Leave()); } }