update
This commit is contained in:
@@ -51,7 +51,6 @@ namespace OnlyScove.Scripts
|
||||
if (animator == null) animator = GetComponentInParent<Animator>();
|
||||
|
||||
// 3. TỰ ĐỘNG TẮT SCRIPT XUNG ĐỘT (CameraOpenDoor) nếu nó đang tồn tại trên Camera
|
||||
// Điều này giúp hệ thống của bạn chiếm quyền điều khiển hoàn toàn
|
||||
var conflictingScript = Object.FindFirstObjectByType<CameraDoorScript.CameraOpenDoor>();
|
||||
if (conflictingScript != null)
|
||||
{
|
||||
@@ -60,31 +59,24 @@ namespace OnlyScove.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
// protected override void PerformInteraction(PlayerStateMachine player)
|
||||
// {
|
||||
// Debug.Log($"[Interaction] PerformInteraction CALLED on {gameObject.name}!");
|
||||
//
|
||||
// // 1. Ưu tiên script của Door Pack (Wood Door Script)
|
||||
// if (woodDoorScript != null)
|
||||
// {
|
||||
// Debug.Log($"[Interaction] Calling woodDoorScript.OpenDoor() on {gameObject.name}. Previous state: {woodDoorScript.open}");
|
||||
// woodDoorScript.OpenDoor();
|
||||
// isOpen = woodDoorScript.open;
|
||||
// Debug.Log($"[Interaction] New state: {woodDoorScript.open}");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // 2. Nếu không có script Pack mới dùng Animator
|
||||
// if (animator != null)
|
||||
// {
|
||||
// isOpen = !isOpen;
|
||||
// animator.SetBool(boolParameterName, isOpen);
|
||||
// Debug.Log($"[Interaction] Triggered Animator: {boolParameterName} = {isOpen}");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Debug.LogError($"[Interaction] FAILED: No woodDoorScript or animator found on {gameObject.name}");
|
||||
// }
|
||||
// }
|
||||
protected override void PerformInteraction(GameObject interactor)
|
||||
{
|
||||
Debug.Log($"[Interaction] PerformInteraction CALLED on {gameObject.name}!");
|
||||
|
||||
// 1. Ưu tiên script của Door Pack (Wood Door Script)
|
||||
if (woodDoorScript != null)
|
||||
{
|
||||
woodDoorScript.OpenDoor();
|
||||
isOpen = woodDoorScript.open;
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Nếu không có script Pack mới dùng Animator
|
||||
if (animator != null)
|
||||
{
|
||||
isOpen = !isOpen;
|
||||
animator.SetBool(boolParameterName, isOpen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user