2026-04-22 버그 수정
This commit is contained in:
Binary file not shown.
@@ -1,20 +1,15 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRShopping.Interact;
|
using VRShopping.Interact;
|
||||||
using VRShopping.Items;
|
using VRShopping.Items;
|
||||||
|
|
||||||
public class BarcodeScaner : MonoBehaviour
|
public class BarcodeScaner : MonoBehaviour
|
||||||
{
|
{
|
||||||
//스캔 원점 및 방향
|
//스캔 영역 콜라이더
|
||||||
[SerializeField] private Transform _scanDirection;
|
[SerializeField] private Collider _scanAreaCollider;
|
||||||
|
|
||||||
//스캔 거리
|
|
||||||
[SerializeField] private float _scanDistance;
|
|
||||||
|
|
||||||
//스캔 반지름
|
|
||||||
[SerializeField] private float _scanRadius;
|
|
||||||
|
|
||||||
//스캔 이펙트
|
//스캔 이펙트
|
||||||
[SerializeField] private GameObject _scanVisualEffect;
|
[SerializeField] private ParticleSystem _scanVisualEffect;
|
||||||
|
|
||||||
//스캔 사운드
|
//스캔 사운드
|
||||||
[SerializeField] private AudioSource _scanSoundEffect;
|
[SerializeField] private AudioSource _scanSoundEffect;
|
||||||
@@ -22,28 +17,23 @@ public class BarcodeScaner : MonoBehaviour
|
|||||||
//체크아웃 정보 저장 객체
|
//체크아웃 정보 저장 객체
|
||||||
[SerializeField] private CheckoutMachine _checkoutMachine;
|
[SerializeField] private CheckoutMachine _checkoutMachine;
|
||||||
|
|
||||||
// 스캔영역을 스캔함
|
private readonly Collider[] _overlapBuffer = new Collider[32];
|
||||||
|
private readonly HashSet<ItemInstance> _scannedBuffer = new();
|
||||||
|
|
||||||
|
// 스캔영역 콜라이더 안에 들어온 아이템들을 스캔함
|
||||||
public void ScanArea()
|
public void ScanArea()
|
||||||
{
|
{
|
||||||
if (_scanDirection == null) return;
|
if (_scanAreaCollider == null) return;
|
||||||
|
|
||||||
ShowScanEffect();
|
var bounds = _scanAreaCollider.bounds;
|
||||||
|
var count = Physics.OverlapBoxNonAlloc(bounds.center, bounds.extents, _overlapBuffer, Quaternion.identity);
|
||||||
|
|
||||||
var origin = _scanDirection.position;
|
_scannedBuffer.Clear();
|
||||||
var direction = _scanDirection.forward;
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
if (!Physics.SphereCast(origin, _scanRadius, direction, out var hit, _scanDistance))
|
var item = _overlapBuffer[i].GetComponentInParent<ItemInstance>();
|
||||||
return;
|
if (item != null && _scannedBuffer.Add(item)) ScanProduction(item);
|
||||||
|
}
|
||||||
var item = hit.collider.GetComponentInParent<ItemInstance>();
|
|
||||||
if (item != null) ScanProduction(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShowScanEffect()
|
|
||||||
{
|
|
||||||
if (_scanVisualEffect == null) return;
|
|
||||||
_scanVisualEffect.SetActive(true);
|
|
||||||
_ = Util.RunDelayed(0.3f, () => _scanVisualEffect.SetActive(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//ItemInstance의 상품 정보를 스캔
|
//ItemInstance의 상품 정보를 스캔
|
||||||
@@ -52,6 +42,7 @@ public void ScanProduction(ItemInstance itemIns)
|
|||||||
//AddCheckoutSum으로 총 계산금액에 더함
|
//AddCheckoutSum으로 총 계산금액에 더함
|
||||||
_checkoutMachine.AddCheckoutSum(itemIns.ItemDataInfo.FinalPrice);
|
_checkoutMachine.AddCheckoutSum(itemIns.ItemDataInfo.FinalPrice);
|
||||||
|
|
||||||
|
if (_scanVisualEffect != null) _scanVisualEffect.Play();
|
||||||
if (_scanSoundEffect != null) _scanSoundEffect.Play();
|
if (_scanSoundEffect != null) _scanSoundEffect.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -52,32 +52,6 @@ AnimatorStateTransition:
|
|||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
m_CanTransitionToSelf: 1
|
m_CanTransitionToSelf: 1
|
||||||
--- !u!1102 &-5966884987565979827
|
|
||||||
AnimatorState:
|
|
||||||
serializedVersion: 6
|
|
||||||
m_ObjectHideFlags: 1
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_Name: Heel
|
|
||||||
m_Speed: 1
|
|
||||||
m_CycleOffset: 0
|
|
||||||
m_Transitions: []
|
|
||||||
m_StateMachineBehaviours: []
|
|
||||||
m_Position: {x: 50, y: 50, z: 0}
|
|
||||||
m_IKOnFeet: 0
|
|
||||||
m_WriteDefaultValues: 1
|
|
||||||
m_Mirror: 0
|
|
||||||
m_SpeedParameterActive: 0
|
|
||||||
m_MirrorParameterActive: 0
|
|
||||||
m_CycleOffsetParameterActive: 0
|
|
||||||
m_TimeParameterActive: 0
|
|
||||||
m_Motion: {fileID: 7400000, guid: eb9185d9382a3a64fbfa8a0ff68489a8, type: 2}
|
|
||||||
m_Tag:
|
|
||||||
m_SpeedParameter:
|
|
||||||
m_MirrorParameter:
|
|
||||||
m_CycleOffsetParameter:
|
|
||||||
m_TimeParameter:
|
|
||||||
--- !u!1101 &-328592594322388879
|
--- !u!1101 &-328592594322388879
|
||||||
AnimatorStateTransition:
|
AnimatorStateTransition:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
@@ -111,7 +85,13 @@ AnimatorController:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: AnimController_Brown
|
m_Name: AnimController_Brown
|
||||||
serializedVersion: 5
|
serializedVersion: 5
|
||||||
m_AnimatorParameters: []
|
m_AnimatorParameters:
|
||||||
|
- m_Name: Expression
|
||||||
|
m_Type: 1
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
m_AnimatorLayers:
|
m_AnimatorLayers:
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Base Layer
|
m_Name: Base Layer
|
||||||
@@ -125,18 +105,6 @@ AnimatorController:
|
|||||||
m_IKPass: 0
|
m_IKPass: 0
|
||||||
m_SyncedLayerAffectsTiming: 0
|
m_SyncedLayerAffectsTiming: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 9100000}
|
||||||
- serializedVersion: 5
|
|
||||||
m_Name: FootOverride
|
|
||||||
m_StateMachine: {fileID: 4760054131638637629}
|
|
||||||
m_Mask: {fileID: 0}
|
|
||||||
m_Motions: []
|
|
||||||
m_Behaviours: []
|
|
||||||
m_BlendingMode: 1
|
|
||||||
m_SyncedLayerIndex: -1
|
|
||||||
m_DefaultWeight: 1
|
|
||||||
m_IKPass: 0
|
|
||||||
m_SyncedLayerAffectsTiming: 0
|
|
||||||
m_Controller: {fileID: 9100000}
|
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Face Layer
|
m_Name: Face Layer
|
||||||
m_StateMachine: {fileID: 6170660395283963564}
|
m_StateMachine: {fileID: 6170660395283963564}
|
||||||
@@ -175,28 +143,6 @@ AnimatorState:
|
|||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
m_CycleOffsetParameter:
|
m_CycleOffsetParameter:
|
||||||
m_TimeParameter:
|
m_TimeParameter:
|
||||||
--- !u!1107 &4760054131638637629
|
|
||||||
AnimatorStateMachine:
|
|
||||||
serializedVersion: 6
|
|
||||||
m_ObjectHideFlags: 1
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_Name: FootOverride
|
|
||||||
m_ChildStates:
|
|
||||||
- serializedVersion: 1
|
|
||||||
m_State: {fileID: -5966884987565979827}
|
|
||||||
m_Position: {x: 10, y: 240, z: 0}
|
|
||||||
m_ChildStateMachines: []
|
|
||||||
m_AnyStateTransitions: []
|
|
||||||
m_EntryTransitions: []
|
|
||||||
m_StateMachineTransitions: {}
|
|
||||||
m_StateMachineBehaviours: []
|
|
||||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
|
||||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
|
||||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
|
||||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
|
||||||
m_DefaultState: {fileID: -5966884987565979827}
|
|
||||||
--- !u!206 &5123552943827446111
|
--- !u!206 &5123552943827446111
|
||||||
BlendTree:
|
BlendTree:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
@@ -343,7 +289,7 @@ AnimatorStateMachine:
|
|||||||
m_ChildStates:
|
m_ChildStates:
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: -7836363615124988089}
|
m_State: {fileID: -7836363615124988089}
|
||||||
m_Position: {x: 30, y: 260, z: 0}
|
m_Position: {x: 20, y: 260, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: 6909750651427599640}
|
m_State: {fileID: 6909750651427599640}
|
||||||
m_Position: {x: 30, y: 190, z: 0}
|
m_Position: {x: 30, y: 190, z: 0}
|
||||||
|
|||||||
Binary file not shown.
@@ -49,7 +49,7 @@ Material:
|
|||||||
m_LightmapFlags: 0
|
m_LightmapFlags: 0
|
||||||
m_EnableInstancingVariants: 1
|
m_EnableInstancingVariants: 1
|
||||||
m_DoubleSidedGI: 0
|
m_DoubleSidedGI: 0
|
||||||
m_CustomRenderQueue: -1
|
m_CustomRenderQueue: 3000
|
||||||
stringTagMap: {}
|
stringTagMap: {}
|
||||||
disabledShaderPasses: []
|
disabledShaderPasses: []
|
||||||
m_LockedProperties:
|
m_LockedProperties:
|
||||||
|
|||||||
Reference in New Issue
Block a user