阶段性完成
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Cielonos.MainGame.Inventory;
|
||||
using Sirenix.OdinInspector;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
@@ -25,9 +26,8 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
public bool IsHoldingPrimary { get; private set; }
|
||||
public bool IsHoldingSecondary { get; private set; }
|
||||
public bool IsHoldingTertiary { get; private set; }
|
||||
public bool IsHoldingQuaternary { get; private set; }
|
||||
public bool IsHoldingQuinary { get; private set; }
|
||||
public bool IsHoldingSpecialA { get; private set; }
|
||||
public bool IsHoldingSpecialB { get; private set; }
|
||||
|
||||
public BoolReactiveProperty isCursorLocked;
|
||||
|
||||
@@ -100,10 +100,12 @@ namespace Cielonos.MainGame.Characters
|
||||
if (IsMoving)
|
||||
{
|
||||
operation.Dash();
|
||||
preinputSubmodule.RegisterPreinputAction(() => operation.Dash(), 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
operation.Dodge();
|
||||
preinputSubmodule.RegisterPreinputAction(() => operation.Dodge(), 10);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -135,6 +137,8 @@ namespace Cielonos.MainGame.Characters
|
||||
};
|
||||
}
|
||||
|
||||
private MainWeaponBase currentMainWeapon => player.inventorySc.equipmentSm.currentMainWeapon;
|
||||
|
||||
private void RegisterMainWeaponInputs()
|
||||
{
|
||||
inputActions.Player.MainWeaponPrimary.started += ctx =>
|
||||
@@ -143,6 +147,11 @@ namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
IsHoldingPrimary = true;
|
||||
operation.MainWeaponPrimaryPress();
|
||||
|
||||
if (!currentMainWeapon.disablePrimaryPreinput)
|
||||
{
|
||||
preinputSubmodule.RegisterPreinputAction(() => operation.MainWeaponPrimaryPress(), 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
inputActions.Player.MainWeaponPrimary.canceled += ctx =>
|
||||
@@ -160,6 +169,11 @@ namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
IsHoldingSecondary = true;
|
||||
operation.MainWeaponSecondaryPress();
|
||||
|
||||
if (!currentMainWeapon.disableSecondaryPreinput)
|
||||
{
|
||||
preinputSubmodule.RegisterPreinputAction(() => operation.MainWeaponSecondaryPress(), 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
inputActions.Player.MainWeaponSecondary.canceled += ctx =>
|
||||
@@ -171,55 +185,50 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.MainWeaponTertiary.started += ctx =>
|
||||
inputActions.Player.MainWeaponSpecialA.started += ctx =>
|
||||
{
|
||||
if (ctx.started && isCursorLocked.Value)
|
||||
{
|
||||
IsHoldingTertiary = true;
|
||||
operation.MainWeaponTertiaryPress();
|
||||
IsHoldingSpecialA = true;
|
||||
operation.MainWeaponSpecialAPress();
|
||||
|
||||
if (!currentMainWeapon.disableSpecialAPreinput)
|
||||
{
|
||||
preinputSubmodule.RegisterPreinputAction(() => operation.MainWeaponSpecialAPress(), 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
inputActions.Player.MainWeaponTertiary.canceled += ctx =>
|
||||
inputActions.Player.MainWeaponSpecialA.canceled += ctx =>
|
||||
{
|
||||
if (ctx.canceled && isCursorLocked.Value)
|
||||
{
|
||||
IsHoldingTertiary = false;
|
||||
operation.MainWeaponTertiaryRelease();
|
||||
IsHoldingSpecialA = false;
|
||||
operation.MainWeaponSpecialARelease();
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.MainWeaponQuaternary.started += ctx =>
|
||||
inputActions.Player.MainWeaponSpecialB.started += ctx =>
|
||||
{
|
||||
if (ctx.started && isCursorLocked.Value)
|
||||
{
|
||||
IsHoldingQuaternary = true;
|
||||
operation.MainWeaponQuaternaryPress();
|
||||
IsHoldingSpecialB = true;
|
||||
operation.MainWeaponSpecialBPress();
|
||||
|
||||
if (!currentMainWeapon.disableSpecialBPreinput)
|
||||
{
|
||||
preinputSubmodule.RegisterPreinputAction(() => operation.MainWeaponSpecialBPress(), 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
inputActions.Player.MainWeaponQuaternary.canceled += ctx =>
|
||||
inputActions.Player.MainWeaponSpecialB.canceled += ctx =>
|
||||
{
|
||||
if (ctx.canceled && isCursorLocked.Value)
|
||||
{
|
||||
IsHoldingQuaternary = false;
|
||||
operation.MainWeaponQuaternaryRelease();
|
||||
}
|
||||
};
|
||||
inputActions.Player.MainWeaponQuinary.performed += ctx =>
|
||||
{
|
||||
if (ctx.performed && isCursorLocked.Value)
|
||||
{
|
||||
operation.MainWeaponQuinaryHold();
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.MainWeaponQuinary.canceled += ctx =>
|
||||
{
|
||||
if (ctx.canceled && isCursorLocked.Value)
|
||||
{
|
||||
IsHoldingQuinary = false;
|
||||
operation.MainWeaponQuinaryRelease();
|
||||
IsHoldingSpecialB = false;
|
||||
operation.MainWeaponSpecialBRelease();
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.SwitchMainWeapon.performed += ctx =>
|
||||
{
|
||||
if (ctx.performed && isCursorLocked.Value)
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
public void RegisterPreinputAction(Action action, int priority)
|
||||
{
|
||||
Debug.Log($"Registering preinput action with priority {priority}, current priority is {currentPreinputPriority}, isReceivingPreinput: {isReceivingPreinput}");
|
||||
//Debug.Log($"Registering preinput action with priority {priority}, current priority is {currentPreinputPriority}, isReceivingPreinput: {isReceivingPreinput}");
|
||||
if (isReceivingPreinput && priority > currentPreinputPriority)
|
||||
{
|
||||
Debug.Log($"Preinput action registered.");
|
||||
|
||||
Reference in New Issue
Block a user