パリィ完成
This commit is contained in:
@@ -246,11 +246,12 @@ public class EnemyAI : MonoBehaviour
|
||||
{
|
||||
if(isDead) return;
|
||||
|
||||
if(currentState == AIState.Stun) return;
|
||||
|
||||
SetFistCollider(false);
|
||||
StopAllCoroutines();
|
||||
isAttacking = false;
|
||||
isWandering = false;
|
||||
isKnockbacking = false;
|
||||
|
||||
if(agent.isOnNavMesh)
|
||||
{
|
||||
|
||||
115
Assets/Scripts/PlayerStatusManager.cs
Normal file
115
Assets/Scripts/PlayerStatusManager.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class PlayerStatusManager : MonoBehaviour
|
||||
{
|
||||
public static PlayerStatusManager Instance { get; private set;}
|
||||
|
||||
[SerializeField] private InputActionProperty zlButtonAction;
|
||||
[SerializeField] private InputActionProperty zrButtonAction;
|
||||
|
||||
[SerializeField] private float maxGauge = 100f;
|
||||
[SerializeField] private float currentGauge = 0f;
|
||||
|
||||
[SerializeField] private GameObject codingModeUI;
|
||||
|
||||
private bool isCodingMode = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if(Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if(zlButtonAction.action != null) zlButtonAction.action.Enable();
|
||||
if(zrButtonAction.action != null) zrButtonAction.action.Enable();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if(zlButtonAction.action != null) zlButtonAction.action.Disable();
|
||||
if(zrButtonAction.action != null) zrButtonAction.action.Disable();
|
||||
}
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
if(codingModeUI != null)
|
||||
{
|
||||
codingModeUI.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
CheckComboInput();
|
||||
}
|
||||
|
||||
public void AddGauge(float amout)
|
||||
{
|
||||
if(isCodingMode) return;
|
||||
|
||||
currentGauge += amout;
|
||||
currentGauge = Mathf.Clamp(currentGauge, 0f, maxGauge);
|
||||
}
|
||||
|
||||
private void CheckComboInput()
|
||||
{
|
||||
if(zlButtonAction.action == null || zrButtonAction.action ==null) return;
|
||||
|
||||
bool zlPressed = zlButtonAction.action.triggered && zlButtonAction.action.ReadValue<float>() > 0.5f;
|
||||
bool zrPressed = zlButtonAction.action.triggered && zrButtonAction.action.ReadValue<float>() > 0.5f;
|
||||
|
||||
if(!isCodingMode && currentGauge >= maxGauge)
|
||||
{
|
||||
if((zlPressed && zrButtonAction.action.ReadValue<float>() > 0.5f) ||
|
||||
(zrPressed && zlButtonAction.action.ReadValue<float>() > 0.5f))
|
||||
{
|
||||
StartCodingMode();
|
||||
}
|
||||
}
|
||||
else if(isCodingMode)
|
||||
{
|
||||
if((zlPressed && zrButtonAction.action.ReadValue<float>() > 0.5f) ||
|
||||
(zrPressed && zlButtonAction.action.ReadValue<float>() > 0.5f))
|
||||
{
|
||||
EndCodingMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StartCodingMode()
|
||||
{
|
||||
isCodingMode = true;
|
||||
|
||||
Time.timeScale = 0f;
|
||||
|
||||
if(codingModeUI != null)
|
||||
{
|
||||
codingModeUI.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void EndCodingMode()
|
||||
{
|
||||
isCodingMode = false;
|
||||
|
||||
Time.timeScale = 1f;
|
||||
|
||||
if(codingModeUI != null)
|
||||
{
|
||||
codingModeUI.SetActive(false);
|
||||
}
|
||||
|
||||
currentGauge = 0f;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/PlayerStatusManager.cs.meta
Normal file
2
Assets/Scripts/PlayerStatusManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0215a75a0f67e1b49a1b823cfc7b8503
|
||||
@@ -102,11 +102,15 @@ public class VRInputPunch : MonoBehaviour
|
||||
{
|
||||
info.amount = (speed * damageMultiplier) * 2f;
|
||||
info.isPoseBonus = true;
|
||||
|
||||
if(PlayerStatusManager.Instance != null) PlayerStatusManager.Instance.AddGauge(20f);
|
||||
}
|
||||
else
|
||||
{
|
||||
info.amount = speed * damageMultiplier;
|
||||
info.isPoseBonus = false;
|
||||
|
||||
if(PlayerStatusManager.Instance != null) PlayerStatusManager.Instance.AddGauge(10f);
|
||||
}
|
||||
info.hitPosition = other.transform.position;
|
||||
info.punchDirection = velocity.normalized;
|
||||
|
||||
Reference in New Issue
Block a user