remove obstacle

This commit is contained in:
2026-06-04 11:50:09 +07:00
parent 162deaf34f
commit 5526341041
50 changed files with 399 additions and 2097 deletions

View File

@@ -10,28 +10,28 @@ namespace OnlyScove.Scripts
public virtual string InteractionPrompt => interactionData != null ? interactionData.promptText : "Interact";
public virtual void OnInteract(PlayerStateMachine player)
{
if (Time.time < lastInteractTime + (interactionData != null ? interactionData.interactionCooldown : 0f))
return;
lastInteractTime = Time.time;
// Play sound if assigned
if (interactionData != null && interactionData.interactionSound != null)
{
AudioSource.PlayClipAtPoint(interactionData.interactionSound, transform.position);
}
// Spawn VFX if assigned
if (interactionData != null && interactionData.interactionVFX != null)
{
Instantiate(interactionData.interactionVFX, transform.position, Quaternion.identity);
}
PerformInteraction(player);
}
protected abstract void PerformInteraction(PlayerStateMachine player);
// public virtual void OnInteract(PlayerStateMachine player)
// {
// if (Time.time < lastInteractTime + (interactionData != null ? interactionData.interactionCooldown : 0f))
// return;
//
// lastInteractTime = Time.time;
//
// // Play sound if assigned
// if (interactionData != null && interactionData.interactionSound != null)
// {
// AudioSource.PlayClipAtPoint(interactionData.interactionSound, transform.position);
// }
//
// // Spawn VFX if assigned
// if (interactionData != null && interactionData.interactionVFX != null)
// {
// Instantiate(interactionData.interactionVFX, transform.position, Quaternion.identity);
// }
//
// PerformInteraction(player);
// }
//
// protected abstract void PerformInteraction(PlayerStateMachine player);
}
}

View File

@@ -60,31 +60,31 @@ 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(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}");
// }
// }
}
}

View File

@@ -44,14 +44,14 @@ namespace OnlyScove.Scripts
UpdateLightState();
}
protected override void PerformInteraction(PlayerStateMachine player)
{
isOn = !isOn;
UpdateLightState();
// Log cực mạnh để bạn kiểm tra Console
Debug.LogWarning($"<color=yellow>[Lamp]</color> Đèn đã chuyển sang: {(isOn ? "BẬT" : "TẮT")}");
}
// protected override void PerformInteraction(PlayerStateMachine player)
// {
// isOn = !isOn;
// UpdateLightState();
//
// // Log cực mạnh để bạn kiểm tra Console
// Debug.LogWarning($"<color=yellow>[Lamp]</color> Đèn đã chuyển sang: {(isOn ? "BẬT" : "TẮT")}");
// }
private void UpdateLightState()
{