private void OnWorldClick(Vector3 position) { Ray ray = Camera.main.ScreenPointToRay(position); RaycastHit raycastHit; if (Physics.Raycast(ray, out raycastHit, MaxInputRange, TargetLayerMask.value)) { switch (raycastHit.collider.gameObject.layer) { case 11: { if (Vector3.Distance(raycastHit.point, PlayerPosition()) < MaxDropItemRange) { OnDropItemClick.Invoke(raycastHit.collider.gameObject.GetComponent <DropItem>()); } else { OnClickTarget.Invoke(raycastHit.point); OnClickTargetNormal.Invoke(raycastHit.point, Vector3.up); } } break; case 12: { OnPlayerClick.Invoke(); } break; } } }
private void OnWorldPointerDown(Vector3 target) { Ray ray = Camera.main.ScreenPointToRay(target); RaycastHit raycastHit; if (Physics.Raycast(ray, out raycastHit, MaxInputRange, TargetLayerMask.value)) { switch (raycastHit.collider.gameObject.layer) { case 8: { OnClickTarget.Invoke(raycastHit.point); OnClickTargetNormal.Invoke(raycastHit.point, raycastHit.normal); } break; } } }