remove obstacle
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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}");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user