Files
VRProject/Assets/Scripts/SlowWebArea.cs
2026-07-01 14:08:37 +09:00

36 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
public class SlowWebArea : MonoBehaviour
{
[SerializeField] private float damagePerSecond = 5f;
private float damageTimer = 0f;
private void OnTriggerStay(Collider other)
{
if (other.CompareTag("Player"))
{
// ★鈍足効果の適用演出
// プレイヤーの移動スクリプトに対し、一時的な速度デバフ(例: Speed * 0.3f)を掛けます
// ここでは設計の切り離しのため、ログ出力のみとしています
Debug.LogWarning("🕸️ プレイヤーが蜘蛛の糸に囚われている! 【鈍足化デバフ発動中】");
// スリップダメージ1秒ごとに継続ダメージ
damageTimer += Time.deltaTime;
if (damageTimer >= 1.0f)
{
// プレイヤーのHealthコンポーネントにダメージを通知
// other.GetComponent<PlayerHealth>()?.TakeDamage(damagePerSecond);
Debug.Log($"🕸️ 糸によるスリップダメージ: {damagePerSecond}");
damageTimer = 0f;
}
}
}
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Player"))
{
Debug.Log("🏃 プレイヤーが糸の範囲から脱出。 鈍足効果解除。");
}
}
}