void FixedUpdate() { rb.velocity = movementJoystick.Direction * speed * Time.deltaTime; if (shootJoystick.Direction != Vector2.zero) { shootDir = shootJoystick.Direction.normalized; currentWeapon.transform.right = shootDir; Debug.DrawRay(transform.position, shootDir, Color.red); if (!isShooting) { isShooting = true; lastRoutine = currentWeapon.StartCoroutine(currentWeapon.Shoot()); } } else { if (isShooting) { currentWeapon.StopCoroutine(lastRoutine); isShooting = false; } } }
public void OnPointerDown(PointerEventData eventData) { Debug.Log("yes"); lastRoutine = currentWeapon.StartCoroutine(currentWeapon.Shoot()); }