スクリプトの整理

This commit is contained in:
oogushiyuuga
2026-06-29 17:23:26 +09:00
parent 4d1dc01b62
commit e8bdb0920d
6 changed files with 74 additions and 123 deletions

View File

@@ -6,19 +6,18 @@ public class PlayerStatusManager : MonoBehaviour
{
public static PlayerStatusManager Instance { get; private set; }
[Header("Codingモード用 入力設定")]
// CodingModeスタート入力ボタン
[SerializeField] private InputActionProperty zlButtonAction;
[SerializeField] private InputActionProperty zrButtonAction;
[Header("ゲージ設定")]
// ゲージ設定
[SerializeField] private float maxGauge = 100f;
[SerializeField] private float currentGauge = 0f;
[Header("表示UI設定")]
[Tooltip("ミニゲーム画面をまとめている親オブジェクトを指定してください")]
// 表示UI設定
[SerializeField] private GameObject codingModeUI;
[Header("バフパラメータ設定")]
// バフパラメータ設定
[SerializeField] private float buffDuration = 10f;
[SerializeField] private float attackBuffMultiplier = 1.5f;
[SerializeField] private float defenseBuffMultiplier = 0.5f;
@@ -71,7 +70,7 @@ public class PlayerStatusManager : MonoBehaviour
if (isCodingMode) return;
currentGauge += amount;
currentGauge = Mathf.Clamp(currentGauge, 0f, maxGauge);
Debug.Log($"🔋 共通ゲージ増加: {currentGauge} / {maxGauge}");
Debug.Log($"共通ゲージ増加: {currentGauge} / {maxGauge}");
}
private void CheckComboInput()
@@ -99,18 +98,15 @@ public class PlayerStatusManager : MonoBehaviour
if (codingModeUI != null)
{
codingModeUI.SetActive(true);
// ★新設:画面が開いた瞬間にミニゲームの盤面をランダム生成してリセットする
CodingModeGridManager gridManager = codingModeUI.GetComponentInChildren<CodingModeGridManager>();
if (gridManager != null) gridManager.ResetAndGenerateMinigame();
}
}
/// <summary>
/// ★ミニゲームクリア時:獲得したバフリストをすべて適用して現実世界を再開する
/// </summary>
// ミニゲームクリア時:獲得したバフリストをすべて適用して現実世界を再開する
public void CompleteCodingMode(List<string> earnedBuffs)
{
Debug.Log("💻 【ハッキング成功 ミニゲームクリア!現実世界に復帰します。");
Debug.Log("ハッキング成功! ミニゲームクリア!現実世界に復帰します。");
foreach (string buff in earnedBuffs)
{
@@ -120,12 +116,10 @@ public class PlayerStatusManager : MonoBehaviour
ResumeGameplay();
}
/// <summary>
/// ★ミニゲーム失敗時:失敗ゾーン接触による強制終了処理(バフなしで復帰)
/// </summary>
// ミニゲーム失敗時:失敗ゾーン接触による強制終了処理(バフなしで復帰)
public void FailCodingMode()
{
Debug.Log("🚨 【ハッキング強制失敗 失敗ゾーンに接触しました。バフなしで復帰します。");
Debug.Log("ハッキング強制失敗 失敗ゾーンに接触しました。バフなしで復帰します。");
ResumeGameplay();
}
@@ -144,15 +138,14 @@ public class PlayerStatusManager : MonoBehaviour
{
case "AttackUp":
attackBuffTimer = buffDuration;
Debug.Log($"⚔️ 攻撃力UPが適用されました。効果時間: {buffDuration}秒");
Debug.Log($"攻撃力UPが適用されました。効果時間: {buffDuration}秒");
break;
case "DefenseUp":
defenseBuffTimer = buffDuration;
Debug.Log($"🛡️ 防御力UPが適用されました。効果時間: {buffDuration}秒");
Debug.Log($"防御力UPが適用されました。効果時間: {buffDuration}秒");
break;
case "Heal":
Debug.Log($"💚 HP回復が適用されました。回復量: {hpHealAmount}");
// ※将来の拡張PlayerHealth.Instance.Heal(hpHealAmount);
Debug.Log($"HP回復が適用されました。回復量: {hpHealAmount}");
break;
}
}
@@ -162,13 +155,13 @@ public class PlayerStatusManager : MonoBehaviour
if (attackBuffTimer > 0f)
{
attackBuffTimer -= Time.deltaTime;
if (attackBuffTimer <= 0f) Debug.Log("⚔️ 攻撃力UPバフの効果が終了しました。");
if (attackBuffTimer <= 0f) Debug.Log("攻撃力UPバフの効果が終了しました。");
}
if (defenseBuffTimer > 0f)
{
defenseBuffTimer -= Time.deltaTime;
if (defenseBuffTimer <= 0f) Debug.Log("🛡️ 防御力UPバフの効果が終了しました。");
if (defenseBuffTimer <= 0f) Debug.Log("防御力UPバフの効果が終了しました。");
}
}
}