// Update is called once per frame void Update() { if (IsAwake && _spawnTimer.CheckThisFrame()) { Instantiate(thingToSpawn, transform.position, transform.rotation); } }
// Update is called once per frame void Update() { if (_invulnTimer != null && _invulnTimer.CheckThisFrame()) { _invulnTimer = null; Color pc = PlayerController.instance.bodyRenderer.color; PlayerController.instance.bodyRenderer.color = new Color(pc.r, pc.g, pc.r, 1.0f); } }
private void shoot() { if (!Input.GetMouseButton(0)) { _shotTimer.Reset(); return; } if (_shotTimer.CheckThisFrame()) { AudioManager.instance.PlaySFX(SoundEffect.Shoot1); Instantiate(bulletToFire, muzzlePoint.position, muzzlePoint.rotation); } }
private void dash() { if (Input.GetKeyDown(KeyCode.Space) && _dashTimer == null && _dashCooldownTimer.CheckThisFrame()) { AudioManager.instance.PlaySFX(SoundEffect.PlayerDash); _currentMoveSpeed = dashSpeed; _dashTimer = new FrameTimer(dashDuration, false); animator.SetTrigger("dash"); PlayerHealthController.instance.MakeInvulnerable(dashInvulnDuration, false); } if (_dashTimer != null && _dashTimer.CheckThisFrame()) { _currentMoveSpeed = moveSpeed; _dashTimer = null; _dashCooldownTimer.Reset(); } }
// Update is called once per frame void Update() { if (!shouldShoot || IsAsleep) { return; } float playerDistance = Vector3.Distance( transform.position, PlayerController.instance.transform.position ); if (playerDistance > shootRange) { return; } if (_shotTimer.CheckThisFrame()) { AudioManager.instance.PlaySFX(SoundEffect.Shoot2); Instantiate(bullet, muzzlePoint.position, muzzlePoint.rotation); } }