// Update is called once per frame void Update() { //if the player has not possessed an object if (!possessedObject) { if (Input.GetMouseButton(0)) { Vector2 rayPos = new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y); RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, acceptMask); if (hit.collider != null) { //Debug.Log("Hit " + hit.collider.transform.gameObject.name); if (hit.collider.transform.gameObject.tag == "Spirit") { //Debug.Log("It's working!"); GameObject target = hit.collider.transform.gameObject; audio.PlayOneShot(swoosh); Possess(target); } } else { //Debug.Log("No hit"); } } } else { if (Input.GetKey(KeyCode.B)) { if (!isRecalling) { isRecalling = true; } } } if (isRecalling) { if (recallTimer > 0) { recallTimer--; } else { Recall(newPlayer); dollah.ResetCombo(); dollah.SubtractDollah(10f); } } }