いろいろやってみた
Playerが蜘蛛にめり込まないようにしたい
This commit is contained in:
36
Assets/_Scripts/SlowWebArea.cs
Normal file
36
Assets/_Scripts/SlowWebArea.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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("🏃 プレイヤーが糸の範囲から脱出。 鈍足効果解除。");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user