void Shoot() { if (Input.GetMouseButtonDown(0)) { if (!VirtualHandler.IsTouched()) { AudioManager.instance.ShootSound(); Vibration.Vibrate(shootVibration); Instantiate(shot, player.transform.position, Quaternion.identity); } } }
// Update is called once per frame void Update() { if (!VirtualHandler.IsTouched()) { transform.position = Vector2.MoveTowards(transform.position, target, speed * Time.deltaTime); } else { transform.position = Vector2.zero; Destroy(gameObject); } if (Vector2.Distance(transform.position, target) < 0.2f) { Destroy(gameObject); } }
// Use this for initialization void Start() { rgb = GetComponent <Rigidbody2D>(); health = GetComponent <PlayerHealth>(); jsMovement = FindObjectOfType <VirtualHandler>(); }