This commit is contained in:
ohgushiyuga
2026-07-22 16:20:19 +09:00
parent 8506e8d155
commit 2f47302b9e
6 changed files with 395 additions and 1331 deletions

View File

@@ -612,8 +612,18 @@ MonoBehaviour:
features: features:
- {fileID: 8736661028334727731} - {fileID: 8736661028334727731}
- {fileID: 3598254934845347770} - {fileID: 3598254934845347770}
- {fileID: -9214271668543163027}
- {fileID: -7680076135584121790}
- {fileID: 1170704673688743257} - {fileID: 1170704673688743257}
- {fileID: -1187533949232362847}
- {fileID: -949347770443697596}
- {fileID: -1529727133502117446}
- {fileID: 5153017048313567732} - {fileID: 5153017048313567732}
- {fileID: 265326132771859475}
- {fileID: 2834828863856360103}
- {fileID: -2851827796942056979}
- {fileID: -8128959895479975907}
- {fileID: -1926258647260940646}
- {fileID: 6481653220666705815} - {fileID: 6481653220666705815}
- {fileID: 7393116930172532905} - {fileID: 7393116930172532905}
- {fileID: 744375598501864353} - {fileID: 744375598501864353}
@@ -1285,8 +1295,8 @@ MonoBehaviour:
features: features:
- {fileID: 7011443450567333355} - {fileID: 7011443450567333355}
- {fileID: -671281728444007487} - {fileID: -671281728444007487}
- {fileID: 7055518550748799546} - {fileID: 6956056911768161135}
- {fileID: 5091991234558418143} - {fileID: -1734471456787174204}
- {fileID: 8980318060753866109} - {fileID: 8980318060753866109}
- {fileID: -6559185765804338520} - {fileID: -6559185765804338520}
- {fileID: -4756202077021157709} - {fileID: -4756202077021157709}
@@ -1297,7 +1307,7 @@ MonoBehaviour:
- {fileID: 348827886137839178} - {fileID: 348827886137839178}
- {fileID: -7499073031166464939} - {fileID: -7499073031166464939}
- {fileID: 7666556398442971420} - {fileID: 7666556398442971420}
- {fileID: 1118878472687837173} - {fileID: 431653824124869831}
- {fileID: 3985858319333531581} - {fileID: 3985858319333531581}
- {fileID: -6511185071715886993} - {fileID: -6511185071715886993}
- {fileID: -4363231183632145407} - {fileID: -4363231183632145407}
@@ -1703,7 +1713,7 @@ MonoBehaviour:
nameUi: 'Android XR: AR Anchor' nameUi: 'Android XR: AR Anchor'
version: 0.1.0 version: 0.1.0
featureIdInternal: com.unity.openxr.feature.arfoundation-androidxr-anchor featureIdInternal: com.unity.openxr.feature.arfoundation-androidxr-anchor
openxrExtensionStrings: XR_ANDROID_trackables XR_ANDROID_device_anchor_persistence openxrExtensionStrings: XR_ANDROID_trackables
company: Unity Technologies company: Unity Technologies
priority: 0 priority: 0
targetOpenXRApiVersion: targetOpenXRApiVersion:
@@ -2672,7 +2682,7 @@ MonoBehaviour:
nameUi: 'Android XR: AR Anchor' nameUi: 'Android XR: AR Anchor'
version: 0.1.0 version: 0.1.0
featureIdInternal: com.unity.openxr.feature.arfoundation-androidxr-anchor featureIdInternal: com.unity.openxr.feature.arfoundation-androidxr-anchor
openxrExtensionStrings: XR_ANDROID_trackables XR_ANDROID_device_anchor_persistence openxrExtensionStrings: XR_ANDROID_trackables
company: Unity Technologies company: Unity Technologies
priority: 0 priority: 0
targetOpenXRApiVersion: targetOpenXRApiVersion:

File diff suppressed because it is too large Load Diff

View File

@@ -3,24 +3,41 @@ using UnityEngine.InputSystem;
using UnityEngine.AI; using UnityEngine.AI;
using System.Collections.Generic; using System.Collections.Generic;
/// <summary>
/// プレイヤーの共通ゲージ、時間停止Codingモード、UI、および各種バフの制限時間を管理するクラス
/// </summary>
public class PlayerStatusManager : MonoBehaviour public class PlayerStatusManager : MonoBehaviour
{ {
public static PlayerStatusManager Instance { get; private set; } public static PlayerStatusManager Instance { get; private set; }
[Header("デバッグ設定")]
[Tooltip("チェックを入れると、ゲージが溜まっていなくてもZLZRでCodingModeを開けますテスト用")]
[SerializeField] private bool ignoreGaugeForDebug = true;
[Header("Codingモード用 入力設定")]
[SerializeField] private InputActionProperty zlButtonAction; [SerializeField] private InputActionProperty zlButtonAction;
[SerializeField] private InputActionProperty zrButtonAction; [SerializeField] private InputActionProperty zrButtonAction;
[Header("プレイヤー移動・操作制御用 入力設定")]
[Tooltip("プレイヤーの移動入力(例: LeftHand Moveのアクションを指定してください")]
[SerializeField] private InputActionProperty moveAction; [SerializeField] private InputActionProperty moveAction;
[Tooltip("プレイヤーの視点回転入力(例: RightHand Turnがあれば指定してください任意")]
[SerializeField] private InputActionProperty turnAction; [SerializeField] private InputActionProperty turnAction;
[Header("パズル制限時間設定")]
[Tooltip("CodingModeパズルの制限時間")]
[SerializeField] private float codingLimitDuration = 15f; [SerializeField] private float codingLimitDuration = 15f;
private float codingTimer = 0f; private float codingTimer = 0f;
[Header("ゲージ設定")]
[SerializeField] private float maxGauge = 100f; [SerializeField] private float maxGauge = 100f;
[SerializeField] private float currentGauge = 0f; [SerializeField] private float currentGauge = 0f;
[Header("表示UI設定")]
[SerializeField] private GameObject codingModeUI; [SerializeField] private GameObject codingModeUI;
[SerializeField] private PuzzleGridBoard puzzleBoard; // 盤面参照 [SerializeField] private PuzzleGridBoard puzzleBoard; // 盤面参照
[Header("バフパラメータ設定")]
[SerializeField] private float buffDuration = 10f; [SerializeField] private float buffDuration = 10f;
[SerializeField] private float attackBuffMultiplier = 1.5f; [SerializeField] private float attackBuffMultiplier = 1.5f;
[SerializeField] private float defenseBuffMultiplier = 0.5f; [SerializeField] private float defenseBuffMultiplier = 0.5f;
@@ -46,6 +63,37 @@ public class PlayerStatusManager : MonoBehaviour
else { Destroy(gameObject); } else { Destroy(gameObject); }
} }
private void OnEnable()
{
EnableAction(zlButtonAction);
EnableAction(zrButtonAction);
EnableAction(moveAction);
EnableAction(turnAction);
}
private void OnDisable()
{
DisableAction(zlButtonAction);
DisableAction(zrButtonAction);
DisableAction(moveAction);
DisableAction(turnAction);
}
private void EnableAction(InputActionProperty property)
{
if (property.action != null) property.action.Enable();
}
private void DisableAction(InputActionProperty property)
{
if (property.action != null) property.action.Disable();
}
private void Start()
{
if (codingModeUI != null) codingModeUI.SetActive(false);
}
private void Update() private void Update()
{ {
CheckComboInput(); CheckComboInput();
@@ -56,6 +104,7 @@ public class PlayerStatusManager : MonoBehaviour
} }
else else
{ {
// CodingMode中の制限時間カウントダウン
codingTimer -= Time.deltaTime; codingTimer -= Time.deltaTime;
if (codingTimer <= 0f) if (codingTimer <= 0f)
{ {
@@ -75,21 +124,35 @@ public class PlayerStatusManager : MonoBehaviour
{ {
if (zlButtonAction.action == null || zrButtonAction.action == null) return; if (zlButtonAction.action == null || zrButtonAction.action == null) return;
bool zlPressed = zlButtonAction.action.triggered && zlButtonAction.action.ReadValue<float>() > 0.5f; // 入力値の読み取り
bool zrPressed = zrButtonAction.action.triggered && zrButtonAction.action.ReadValue<float>() > 0.5f; float zlVal = zlButtonAction.action.ReadValue<float>();
float zrVal = zrButtonAction.action.ReadValue<float>();
bool isComboTriggered = (zlPressed && zrButtonAction.action.ReadValue<float>() > 0.5f) || bool zlPressed = zlButtonAction.action.triggered || zlVal > 0.5f;
(zrPressed && zlButtonAction.action.ReadValue<float>() > 0.5f); bool zrPressed = zrButtonAction.action.triggered || zrVal > 0.5f;
if (isComboTriggered) // 両方のトリガーが引かれているか
bool isBothHeld = zlVal > 0.5f && zrVal > 0.5f;
bool isAnyTriggered = zlButtonAction.action.triggered || zrButtonAction.action.triggered;
if (isBothHeld && isAnyTriggered)
{ {
if (!isCodingMode && currentGauge >= maxGauge) if (!isCodingMode)
{
// ゲージチェックデバッグフラグがONならゲージ無視で起動
if (ignoreGaugeForDebug || currentGauge >= maxGauge)
{ {
StartCodingMode(); StartCodingMode();
} }
else if (isCodingMode) else
{ {
CancelCodingMode(); // 手動キャンセルはゲージ維持 Debug.LogWarning($"⚠️ ゲージが足りないためCodingModeを開けません。現在: {currentGauge} / 必要: {maxGauge}");
}
}
else
{
// CodingMode中に再度同時押し ➔ キャンセルして無消費で復帰
CancelCodingMode();
} }
} }
} }
@@ -97,12 +160,13 @@ public class PlayerStatusManager : MonoBehaviour
private void StartCodingMode() private void StartCodingMode()
{ {
isCodingMode = true; isCodingMode = true;
codingTimer = codingLimitDuration; // タイマーリセット codingTimer = codingLimitDuration;
if (puzzleBoard != null) puzzleBoard.ClearBoard(); if (puzzleBoard != null) puzzleBoard.ClearBoard();
if (moveAction.action != null) moveAction.action.Disable(); DisableAction(moveAction);
if (turnAction.action != null) turnAction.action.Disable(); DisableAction(turnAction);
// 敵のアニメーション・NavMesh停止
foreach (var anim in FindObjectsByType<Animator>(FindObjectsSortMode.None)) foreach (var anim in FindObjectsByType<Animator>(FindObjectsSortMode.None))
{ {
if (anim == null || anim.gameObject == this.gameObject || anim.CompareTag("Player")) continue; if (anim == null || anim.gameObject == this.gameObject || anim.CompareTag("Player")) continue;
@@ -130,13 +194,13 @@ public class PlayerStatusManager : MonoBehaviour
private void FailCodingModeByTimeout() private void FailCodingModeByTimeout()
{ {
ResumeWorldState(consumeGauge: true); // 失敗したのでゲージは消費される ResumeWorldState(consumeGauge: true);
Debug.Log("💀 時間切れ! Codingモード失敗バフなし・ゲージ消費。"); Debug.Log("💀 時間切れ! Codingモード失敗バフなし・ゲージ消費。");
} }
public void CancelCodingMode() public void CancelCodingMode()
{ {
ResumeWorldState(consumeGauge: false); // 手動キャンセルはゲージ消費なし ResumeWorldState(consumeGauge: false);
Debug.Log("↩️ Codingモード手動キャンセル。"); Debug.Log("↩️ Codingモード手動キャンセル。");
} }
@@ -148,8 +212,8 @@ public class PlayerStatusManager : MonoBehaviour
foreach (var agent in pausedAgents) { if (agent != null && agent.enabled) agent.isStopped = false; } foreach (var agent in pausedAgents) { if (agent != null && agent.enabled) agent.isStopped = false; }
pausedAgents.Clear(); pausedAgents.Clear();
if (moveAction.action != null) moveAction.action.Enable(); EnableAction(moveAction);
if (turnAction.action != null) turnAction.action.Enable(); EnableAction(turnAction);
isCodingMode = false; isCodingMode = false;
if (codingModeUI != null) codingModeUI.SetActive(false); if (codingModeUI != null) codingModeUI.SetActive(false);

View File

@@ -45,7 +45,7 @@ public class PuzzleBlock : MonoBehaviour
{ {
List<Vector2Int> rotated = new List<Vector2Int>(); List<Vector2Int> rotated = new List<Vector2Int>();
// 現在のY回転を90度単位に丸める (0, 1, 2, 3) // 現在のY回転を90度単位に丸める (0, 1, 2, 3)
int steps = Mathf.RoundToInt(transform.eulerAngles.y / 90f) % 4; int steps = Mathf.RoundToInt(transform.eulerAngles.y / 180f) % 4;
if (steps < 0) steps += 4; if (steps < 0) steps += 4;
foreach (var cell in LocalCells) foreach (var cell in LocalCells)

View File

@@ -7,6 +7,7 @@
"com.unity.inputsystem": "1.17.0", "com.unity.inputsystem": "1.17.0",
"com.unity.learn.iet-framework": "5.0.3", "com.unity.learn.iet-framework": "5.0.3",
"com.unity.multiplayer.center": "1.0.1", "com.unity.multiplayer.center": "1.0.1",
"com.unity.recorder": "5.1.6",
"com.unity.render-pipelines.universal": "17.3.0", "com.unity.render-pipelines.universal": "17.3.0",
"com.unity.timeline": "1.8.12", "com.unity.timeline": "1.8.12",
"com.unity.visualeffectgraph": "17.3.0", "com.unity.visualeffectgraph": "17.3.0",

View File

@@ -15,6 +15,15 @@
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
}, },
"com.unity.bindings.openimageio": {
"version": "1.0.2",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.collections": "1.2.4"
},
"url": "https://packages.unity.com"
},
"com.unity.burst": { "com.unity.burst": {
"version": "1.8.27", "version": "1.8.27",
"depth": 2, "depth": 2,
@@ -27,7 +36,7 @@
}, },
"com.unity.collections": { "com.unity.collections": {
"version": "2.6.2", "version": "2.6.2",
"depth": 2, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.burst": "1.8.23", "com.unity.burst": "1.8.23",
@@ -118,7 +127,7 @@
}, },
"com.unity.nuget.mono-cecil": { "com.unity.nuget.mono-cecil": {
"version": "1.11.6", "version": "1.11.6",
"depth": 3, "depth": 2,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
@@ -130,6 +139,17 @@
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
}, },
"com.unity.recorder": {
"version": "5.1.6",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.timeline": "1.8.7",
"com.unity.collections": "1.2.4",
"com.unity.bindings.openimageio": "1.0.2"
},
"url": "https://packages.unity.com"
},
"com.unity.render-pipelines.core": { "com.unity.render-pipelines.core": {
"version": "17.3.0", "version": "17.3.0",
"depth": 1, "depth": 1,
@@ -197,7 +217,7 @@
}, },
"com.unity.test-framework.performance": { "com.unity.test-framework.performance": {
"version": "3.2.0", "version": "3.2.0",
"depth": 3, "depth": 2,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.test-framework": "1.1.33", "com.unity.test-framework": "1.1.33",