Hpbar
This commit is contained in:
@@ -612,8 +612,18 @@ MonoBehaviour:
|
||||
features:
|
||||
- {fileID: 8736661028334727731}
|
||||
- {fileID: 3598254934845347770}
|
||||
- {fileID: -9214271668543163027}
|
||||
- {fileID: -7680076135584121790}
|
||||
- {fileID: 1170704673688743257}
|
||||
- {fileID: -1187533949232362847}
|
||||
- {fileID: -949347770443697596}
|
||||
- {fileID: -1529727133502117446}
|
||||
- {fileID: 5153017048313567732}
|
||||
- {fileID: 265326132771859475}
|
||||
- {fileID: 2834828863856360103}
|
||||
- {fileID: -2851827796942056979}
|
||||
- {fileID: -8128959895479975907}
|
||||
- {fileID: -1926258647260940646}
|
||||
- {fileID: 6481653220666705815}
|
||||
- {fileID: 7393116930172532905}
|
||||
- {fileID: 744375598501864353}
|
||||
@@ -1285,8 +1295,8 @@ MonoBehaviour:
|
||||
features:
|
||||
- {fileID: 7011443450567333355}
|
||||
- {fileID: -671281728444007487}
|
||||
- {fileID: 7055518550748799546}
|
||||
- {fileID: 5091991234558418143}
|
||||
- {fileID: 6956056911768161135}
|
||||
- {fileID: -1734471456787174204}
|
||||
- {fileID: 8980318060753866109}
|
||||
- {fileID: -6559185765804338520}
|
||||
- {fileID: -4756202077021157709}
|
||||
@@ -1297,7 +1307,7 @@ MonoBehaviour:
|
||||
- {fileID: 348827886137839178}
|
||||
- {fileID: -7499073031166464939}
|
||||
- {fileID: 7666556398442971420}
|
||||
- {fileID: 1118878472687837173}
|
||||
- {fileID: 431653824124869831}
|
||||
- {fileID: 3985858319333531581}
|
||||
- {fileID: -6511185071715886993}
|
||||
- {fileID: -4363231183632145407}
|
||||
@@ -1703,7 +1713,7 @@ MonoBehaviour:
|
||||
nameUi: 'Android XR: AR Anchor'
|
||||
version: 0.1.0
|
||||
featureIdInternal: com.unity.openxr.feature.arfoundation-androidxr-anchor
|
||||
openxrExtensionStrings: XR_ANDROID_trackables XR_ANDROID_device_anchor_persistence
|
||||
openxrExtensionStrings: XR_ANDROID_trackables
|
||||
company: Unity Technologies
|
||||
priority: 0
|
||||
targetOpenXRApiVersion:
|
||||
@@ -2672,7 +2682,7 @@ MonoBehaviour:
|
||||
nameUi: 'Android XR: AR Anchor'
|
||||
version: 0.1.0
|
||||
featureIdInternal: com.unity.openxr.feature.arfoundation-androidxr-anchor
|
||||
openxrExtensionStrings: XR_ANDROID_trackables XR_ANDROID_device_anchor_persistence
|
||||
openxrExtensionStrings: XR_ANDROID_trackables
|
||||
company: Unity Technologies
|
||||
priority: 0
|
||||
targetOpenXRApiVersion:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,24 +3,41 @@ using UnityEngine.InputSystem;
|
||||
using UnityEngine.AI;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// プレイヤーの共通ゲージ、時間停止(Codingモード)、UI、および各種バフの制限時間を管理するクラス
|
||||
/// </summary>
|
||||
public class PlayerStatusManager : MonoBehaviour
|
||||
{
|
||||
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 zrButtonAction;
|
||||
|
||||
[Header("プレイヤー移動・操作制御用 入力設定")]
|
||||
[Tooltip("プレイヤーの移動入力(例: LeftHand Move)のアクションを指定してください")]
|
||||
[SerializeField] private InputActionProperty moveAction;
|
||||
[Tooltip("プレイヤーの視点回転入力(例: RightHand Turn)があれば指定してください(任意)")]
|
||||
[SerializeField] private InputActionProperty turnAction;
|
||||
|
||||
[Header("パズル制限時間設定")]
|
||||
[Tooltip("CodingModeパズルの制限時間(秒)")]
|
||||
[SerializeField] private float codingLimitDuration = 15f;
|
||||
private float codingTimer = 0f;
|
||||
|
||||
[Header("ゲージ設定")]
|
||||
[SerializeField] private float maxGauge = 100f;
|
||||
[SerializeField] private float currentGauge = 0f;
|
||||
|
||||
[Header("表示UI設定")]
|
||||
[SerializeField] private GameObject codingModeUI;
|
||||
[SerializeField] private PuzzleGridBoard puzzleBoard; // 盤面参照
|
||||
|
||||
[Header("バフパラメータ設定")]
|
||||
[SerializeField] private float buffDuration = 10f;
|
||||
[SerializeField] private float attackBuffMultiplier = 1.5f;
|
||||
[SerializeField] private float defenseBuffMultiplier = 0.5f;
|
||||
@@ -46,6 +63,37 @@ public class PlayerStatusManager : MonoBehaviour
|
||||
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()
|
||||
{
|
||||
CheckComboInput();
|
||||
@@ -56,6 +104,7 @@ public class PlayerStatusManager : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
// CodingMode中の制限時間カウントダウン
|
||||
codingTimer -= Time.deltaTime;
|
||||
if (codingTimer <= 0f)
|
||||
{
|
||||
@@ -75,21 +124,35 @@ public class PlayerStatusManager : MonoBehaviour
|
||||
{
|
||||
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) ||
|
||||
(zrPressed && zlButtonAction.action.ReadValue<float>() > 0.5f);
|
||||
bool zlPressed = zlButtonAction.action.triggered || zlVal > 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)
|
||||
{
|
||||
StartCodingMode();
|
||||
// ゲージチェック(デバッグフラグがONならゲージ無視で起動)
|
||||
if (ignoreGaugeForDebug || currentGauge >= maxGauge)
|
||||
{
|
||||
StartCodingMode();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"⚠️ ゲージが足りないためCodingModeを開けません。現在: {currentGauge} / 必要: {maxGauge}");
|
||||
}
|
||||
}
|
||||
else if (isCodingMode)
|
||||
else
|
||||
{
|
||||
CancelCodingMode(); // 手動キャンセルはゲージ維持
|
||||
// CodingMode中に再度同時押し ➔ キャンセルして無消費で復帰
|
||||
CancelCodingMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,12 +160,13 @@ public class PlayerStatusManager : MonoBehaviour
|
||||
private void StartCodingMode()
|
||||
{
|
||||
isCodingMode = true;
|
||||
codingTimer = codingLimitDuration; // タイマーリセット
|
||||
codingTimer = codingLimitDuration;
|
||||
|
||||
if (puzzleBoard != null) puzzleBoard.ClearBoard();
|
||||
if (moveAction.action != null) moveAction.action.Disable();
|
||||
if (turnAction.action != null) turnAction.action.Disable();
|
||||
DisableAction(moveAction);
|
||||
DisableAction(turnAction);
|
||||
|
||||
// 敵のアニメーション・NavMesh停止
|
||||
foreach (var anim in FindObjectsByType<Animator>(FindObjectsSortMode.None))
|
||||
{
|
||||
if (anim == null || anim.gameObject == this.gameObject || anim.CompareTag("Player")) continue;
|
||||
@@ -130,13 +194,13 @@ public class PlayerStatusManager : MonoBehaviour
|
||||
|
||||
private void FailCodingModeByTimeout()
|
||||
{
|
||||
ResumeWorldState(consumeGauge: true); // 失敗したのでゲージは消費される
|
||||
ResumeWorldState(consumeGauge: true);
|
||||
Debug.Log("💀 時間切れ! Codingモード失敗(バフなし・ゲージ消費)。");
|
||||
}
|
||||
|
||||
public void CancelCodingMode()
|
||||
{
|
||||
ResumeWorldState(consumeGauge: false); // 手動キャンセルはゲージ消費なし
|
||||
ResumeWorldState(consumeGauge: false);
|
||||
Debug.Log("↩️ Codingモード手動キャンセル。");
|
||||
}
|
||||
|
||||
@@ -148,8 +212,8 @@ public class PlayerStatusManager : MonoBehaviour
|
||||
foreach (var agent in pausedAgents) { if (agent != null && agent.enabled) agent.isStopped = false; }
|
||||
pausedAgents.Clear();
|
||||
|
||||
if (moveAction.action != null) moveAction.action.Enable();
|
||||
if (turnAction.action != null) turnAction.action.Enable();
|
||||
EnableAction(moveAction);
|
||||
EnableAction(turnAction);
|
||||
|
||||
isCodingMode = false;
|
||||
if (codingModeUI != null) codingModeUI.SetActive(false);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PuzzleBlock : MonoBehaviour
|
||||
{
|
||||
List<Vector2Int> rotated = new List<Vector2Int>();
|
||||
// 現在の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;
|
||||
|
||||
foreach (var cell in LocalCells)
|
||||
|
||||
Reference in New Issue
Block a user