private void PlayerClickedLeft() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo, 100, canClickLayer)) { vCont.MoveTo(hitInfo.point); } }
private void ChasePlayer() { if (Vector3.Distance(vCont.Position, playerVCont.Position) >= attackRange) { vCont.MoveTo(playerVCont.Position); } else { if (canAttack) { Attack(); } } }
private void PlayerClickedLeft() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo, 100)) { if (hitInfo.collider.tag == "Enemy") { targetVCont = hitInfo.collider.GetComponent <VirtualController>(); state = PlayerState.Chasing; } else { state = PlayerState.Walking; targetVCont = null; } vCont.MoveTo(hitInfo.point); } }