HPbarzissou
This commit is contained in:
44
Assets/Test/Bossdebug.cs
Normal file
44
Assets/Test/Bossdebug.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class BossDebugController : MonoBehaviour
|
||||
{
|
||||
private BossController bossController;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// 同一オブジェクトにあるBossControllerを自動取得
|
||||
bossController = GetComponent<BossController>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// ─── ★キーボードの『U(Ultimate)』キーを押したら強制発動 ───
|
||||
if (Input.GetKeyDown(KeyCode.U))
|
||||
{
|
||||
TriggerDebugUltimate();
|
||||
}
|
||||
|
||||
// ─── ついでにあると便利な機能:『S(Stun)』キーで即座にパリィスタン ───
|
||||
if (Input.GetKeyDown(KeyCode.S))
|
||||
{
|
||||
TriggerDebugStun();
|
||||
}
|
||||
}
|
||||
|
||||
private void TriggerDebugUltimate()
|
||||
{
|
||||
if (bossController == null) return;
|
||||
|
||||
Debug.Log("🛠️ 【キーボードデバッグ】強制的に必殺技(天井ジャンプ)を発動します。");
|
||||
bossController.PendingUltimate = true;
|
||||
bossController.ChangeState<SpiderJumpToCeilingState>();
|
||||
}
|
||||
|
||||
private void TriggerDebugStun()
|
||||
{
|
||||
if (bossController == null) return;
|
||||
|
||||
Debug.Log("🛡️ 【キーボードデバッグ】強制的にパリィスタン(チャンスタイム)を発動します。");
|
||||
bossController.ChangeState<SpiderStunState>();
|
||||
}
|
||||
}
|
||||
2
Assets/Test/Bossdebug.cs.meta
Normal file
2
Assets/Test/Bossdebug.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2cd755b0c100204e833df85acb412e8
|
||||
58
Assets/Test/InputManagerLR.cs
Normal file
58
Assets/Test/InputManagerLR.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class InputManagerLR : MonoBehaviour
|
||||
{
|
||||
private static InputManagerLR instance;
|
||||
|
||||
[SerializeField] private InputActionAsset actionAsset;
|
||||
|
||||
private InputActionMap actionMap;
|
||||
private InputAction primaryButtonR;
|
||||
private InputAction secondaryButtonR;
|
||||
private InputAction primaryButtonL;
|
||||
private InputAction secondaryButtonL;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance != null && instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
|
||||
if (actionAsset != null)
|
||||
{
|
||||
actionMap = actionAsset.FindActionMap("Test");
|
||||
if (actionMap != null)
|
||||
{
|
||||
primaryButtonR = actionMap.FindAction("XR_PrimaryButtonR", throwIfNotFound: false);
|
||||
primaryButtonL = actionMap.FindAction("XR_PrimaryButtonL", throwIfNotFound: false);
|
||||
secondaryButtonR = actionMap.FindAction("XR_SecondaryButtonR", throwIfNotFound: false);
|
||||
secondaryButtonL = actionMap.FindAction("XR_SecondaryButtonL", throwIfNotFound: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable() => actionMap?.Enable();
|
||||
private void OnDisable() => actionMap?.Disable();
|
||||
|
||||
public static bool PrimaryButtonR() => instance?.primaryButtonR?.IsPressed() ?? false;
|
||||
public static bool PrimaryButtonR_OnPress() => instance?.primaryButtonR?.WasPressedThisFrame() ?? false;
|
||||
public static bool PrimaryButtonR_OnRelease() => instance?.primaryButtonR?.WasReleasedThisFrame() ?? false;
|
||||
|
||||
public static bool PrimaryButtonL() => instance?.primaryButtonL?.IsPressed() ?? false;
|
||||
public static bool PrimaryButtonL_OnPress() => instance?.primaryButtonL?.WasPressedThisFrame() ?? false;
|
||||
public static bool PrimaryButtonL_OnRelease() => instance?.primaryButtonL?.WasReleasedThisFrame() ?? false;
|
||||
|
||||
public static bool SecondaryButtonR() => instance?.secondaryButtonR?.IsPressed() ?? false;
|
||||
public static bool SecondaryButtonR_OnPress() => instance?.secondaryButtonR?.WasPressedThisFrame() ?? false;
|
||||
public static bool SecondaryButtonR_OnRelease() => instance?.secondaryButtonR?.WasReleasedThisFrame() ?? false;
|
||||
|
||||
public static bool SecondaryButtonL() => instance?.secondaryButtonL?.IsPressed() ?? false;
|
||||
public static bool SecondaryButtonL_OnPress() => instance?.secondaryButtonL?.WasPressedThisFrame() ?? false;
|
||||
public static bool SecondaryButtonL_OnRelease() => instance?.secondaryButtonL?.WasReleasedThisFrame() ?? false;
|
||||
}
|
||||
2
Assets/Test/InputManagerLR.cs.meta
Normal file
2
Assets/Test/InputManagerLR.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fc595679af414674be369cd3d5bc765
|
||||
62
Assets/Test/ItemCountDown.cs
Normal file
62
Assets/Test/ItemCountDown.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ItemCountDown : MonoBehaviour
|
||||
{
|
||||
|
||||
public GameObject gameObjectRestore; //ゲームオブフェクトの復帰する座標を指定する
|
||||
|
||||
private bool isGrabbed = false;
|
||||
private bool isTouching = false;
|
||||
|
||||
public float grabItemTimeLimit = 5.0f; //ゲームオブジェクトの位置がリセットされるまでのタイマー
|
||||
private float timer; //スクリプト内のタイマーに用いる変数
|
||||
|
||||
void Start()
|
||||
{
|
||||
timer = 0.0f;
|
||||
}
|
||||
|
||||
public void GetGrab()
|
||||
{
|
||||
isGrabbed = true;
|
||||
isTouching = true;
|
||||
}
|
||||
|
||||
public void ExitGrab()
|
||||
{
|
||||
isTouching = false;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
//制限時間が0秒の場合は、位置のリセットを実行しない
|
||||
if (grabItemTimeLimit != 0)
|
||||
{
|
||||
if (isGrabbed == true)
|
||||
{
|
||||
if (isTouching == false)
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
|
||||
if (timer > grabItemTimeLimit)
|
||||
{
|
||||
//ゲームオブジェクトの速度をリセット
|
||||
var rigidbody = GetComponent<Rigidbody>();
|
||||
rigidbody.linearVelocity = Vector3.zero;
|
||||
//ゲームオブジェクトを指定位置に配置する
|
||||
rigidbody.transform.position = gameObjectRestore.transform.position;
|
||||
rigidbody.transform.rotation = gameObjectRestore.transform.rotation;
|
||||
//ゲームオブジェクトは不動の状態に戻る
|
||||
isGrabbed = false;
|
||||
timer = 0.0f;
|
||||
}
|
||||
}
|
||||
//プレイヤーが触っている場合はカウントダウンをリセット
|
||||
else
|
||||
{
|
||||
timer = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Test/ItemCountDown.cs.meta
Normal file
2
Assets/Test/ItemCountDown.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45dd4c486e2a64ef5a8f38d756b9dc2d
|
||||
39
Assets/Test/PlayerMove.cs
Normal file
39
Assets/Test/PlayerMove.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
// パラメータ
|
||||
public float moveSpeed = 5f; // 移動速度
|
||||
public float gravity = -9.8f; // 重力加速度
|
||||
public CharacterController controller; // 移動に使うCharacterController
|
||||
|
||||
// 演算用変数
|
||||
private Vector3 velocity; // 加速度を保持する変数
|
||||
private bool isGrounded; // 地面に着地しているかどうかのフラグ変数
|
||||
|
||||
// ゲーム中実行されるUpdate関数
|
||||
void Update()
|
||||
{
|
||||
// 着地状態のチェック
|
||||
isGrounded = controller.isGrounded;
|
||||
|
||||
// 着地している場合は落下速度をリセット
|
||||
if (isGrounded && velocity.y < 0)
|
||||
{
|
||||
velocity.y = -2f; // 地面に着いた場合、速度をリセット
|
||||
}
|
||||
|
||||
// 入力の取得
|
||||
float h = Input.GetAxis("Horizontal");
|
||||
float v = Input.GetAxis("Vertical");
|
||||
|
||||
// ローカル座標をワールド座標に変換して移動方向を計算
|
||||
Vector3 moveDirection = transform.TransformDirection(new Vector3(h, 0, v)) * moveSpeed;
|
||||
|
||||
// 重力を加算
|
||||
velocity.y += gravity * Time.deltaTime;
|
||||
|
||||
// 移動と重力を一度のcontroller.Moveで処理
|
||||
controller.Move((moveDirection + velocity) * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
2
Assets/Test/PlayerMove.cs.meta
Normal file
2
Assets/Test/PlayerMove.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c101f16cf16d4195ba45ae89a7f14d8
|
||||
37
Assets/Test/PlayerPOV.cs
Normal file
37
Assets/Test/PlayerPOV.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerPOV : MonoBehaviour
|
||||
{
|
||||
// パラメータ
|
||||
public Transform neck; // プレイヤーの首のTransformを指定
|
||||
public float sensitivity = 2.0f; // マウス感度(視点の移動の速さを調整)
|
||||
public float minVertical = -90.0f; // 視点の最小角度(縦の回転制限)
|
||||
public float maxVertical = 90.0f; // 視点の最大角度(縦の回転制限)
|
||||
|
||||
// 演算用変数
|
||||
private float rotationX = 0f; // 縦方向の回転角度(首の回転)
|
||||
|
||||
// ゲーム開始時に呼ばれる
|
||||
void Start()
|
||||
{
|
||||
// カーソルを非表示&ロック
|
||||
Cursor.lockState = CursorLockMode.Locked; // カーソルを画面中央に固定
|
||||
Cursor.visible = false; // カーソルを非表示にする
|
||||
}
|
||||
|
||||
// 毎フレーム実行される
|
||||
void Update()
|
||||
{
|
||||
// マウス入力の取得
|
||||
float mouseX = Input.GetAxis("Mouse X") * sensitivity; // 横のマウス移動量を取得し、感度で調整
|
||||
float mouseY = Input.GetAxis("Mouse Y") * sensitivity; // 縦のマウス移動量を取得し、感度で調整
|
||||
|
||||
// Player(体)の回転(左右)
|
||||
transform.Rotate(0, mouseX, 0); // プレイヤー(体)の左右の回転をマウスX方向の入力に合わせて行う
|
||||
|
||||
// Neck(首)の回転(上下)
|
||||
rotationX -= mouseY; // マウスY方向の入力によって縦方向の回転を更新
|
||||
rotationX = Mathf.Clamp(rotationX, minVertical, maxVertical); // 回転角度を指定された範囲に制限
|
||||
neck.localRotation = Quaternion.Euler(rotationX, 0, 0); // 首の回転を設定。縦方向のみ回転させる
|
||||
}
|
||||
}
|
||||
2
Assets/Test/PlayerPOV.cs.meta
Normal file
2
Assets/Test/PlayerPOV.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20e0bce59a58a401ca841697d32fb339
|
||||
Reference in New Issue
Block a user