new autotargettinf script, dash
This commit is contained in:
@@ -17,6 +17,8 @@ namespace Beyond
|
||||
public GameObject ComsumableButton;
|
||||
public GameObject ComsumableFaithButton;
|
||||
public GameObject powerButtonsParent;
|
||||
|
||||
public Button DashButton;
|
||||
public Button RunButton;
|
||||
public Button TargetButton;
|
||||
public Button JumpButton;
|
||||
@@ -58,54 +60,55 @@ namespace Beyond
|
||||
private List<TriggerDescriptor> m_Triggers = new List<TriggerDescriptor>();
|
||||
|
||||
private GameStateManager.State m_prevGameState = GameStateManager.State.NORMAL;
|
||||
|
||||
/*
|
||||
private List<TriggerObject> m_triggers = new List<TriggerObject>();
|
||||
public enum TriggerType
|
||||
{
|
||||
Dialogue,
|
||||
Ladder,
|
||||
Generic,
|
||||
Collectable,
|
||||
COUNT
|
||||
};
|
||||
private List<TriggerObject> m_triggers = new List<TriggerObject>();
|
||||
public enum TriggerType
|
||||
{
|
||||
Dialogue,
|
||||
Ladder,
|
||||
Generic,
|
||||
Collectable,
|
||||
COUNT
|
||||
};
|
||||
|
||||
public struct TriggerObject : IComparable<TriggerObject>, IComparable
|
||||
{
|
||||
public GameObject obj;
|
||||
public TriggerType type;
|
||||
public struct TriggerObject : IComparable<TriggerObject>, IComparable
|
||||
{
|
||||
public GameObject obj;
|
||||
public TriggerType type;
|
||||
|
||||
public int CompareTo(TriggerObject other)
|
||||
{
|
||||
return type.CompareTo(other.type);
|
||||
}
|
||||
public int CompareTo(TriggerObject other)
|
||||
{
|
||||
return type.CompareTo(other.type);
|
||||
}
|
||||
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return 1;
|
||||
return obj is TriggerObject other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TriggerObject)}");
|
||||
}
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return 1;
|
||||
return obj is TriggerObject other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TriggerObject)}");
|
||||
}
|
||||
|
||||
public static bool operator <(TriggerObject left, TriggerObject right)
|
||||
{
|
||||
return left.CompareTo(right) < 0;
|
||||
}
|
||||
public static bool operator <(TriggerObject left, TriggerObject right)
|
||||
{
|
||||
return left.CompareTo(right) < 0;
|
||||
}
|
||||
|
||||
public static bool operator >(TriggerObject left, TriggerObject right)
|
||||
{
|
||||
return left.CompareTo(right) > 0;
|
||||
}
|
||||
public static bool operator >(TriggerObject left, TriggerObject right)
|
||||
{
|
||||
return left.CompareTo(right) > 0;
|
||||
}
|
||||
|
||||
public static bool operator <=(TriggerObject left, TriggerObject right)
|
||||
{
|
||||
return left.CompareTo(right) <= 0;
|
||||
}
|
||||
public static bool operator <=(TriggerObject left, TriggerObject right)
|
||||
{
|
||||
return left.CompareTo(right) <= 0;
|
||||
}
|
||||
|
||||
public static bool operator >=(TriggerObject left, TriggerObject right)
|
||||
{
|
||||
return left.CompareTo(right) >= 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
public static bool operator >=(TriggerObject left, TriggerObject right)
|
||||
{
|
||||
return left.CompareTo(right) >= 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
@@ -174,10 +177,12 @@ namespace Beyond
|
||||
// JumpButton.interactable = !activate;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
private void Start()
|
||||
{
|
||||
ActionTriggerEnter += OnInvokeActionTriggerEnter;
|
||||
ActionTriggerExit += OnInvokeActionTriggerExit;
|
||||
GameStateManager.Instance.m_OnStateChanged.AddListener(OnGameStateChanged);
|
||||
|
||||
/*
|
||||
LadderTriggerEnter += OnInvokeLadderTriggerEnter;
|
||||
LadderTriggerExit += OnInvokeLadderTriggerExit;
|
||||
@@ -194,6 +199,8 @@ namespace Beyond
|
||||
{
|
||||
ActionTriggerEnter -= OnInvokeActionTriggerEnter;
|
||||
ActionTriggerExit -= OnInvokeActionTriggerExit;
|
||||
if (GameStateManager.Instance)
|
||||
GameStateManager.Instance.m_OnStateChanged.RemoveListener(OnGameStateChanged);
|
||||
/*
|
||||
LadderTriggerEnter -= OnInvokeLadderTriggerEnter;
|
||||
LadderTriggerExit -= OnInvokeLadderTriggerExit;
|
||||
@@ -204,6 +211,18 @@ namespace Beyond
|
||||
*/
|
||||
}
|
||||
|
||||
void OnGameStateChanged(GameStateManager.State state)
|
||||
{
|
||||
if (state == GameStateManager.State.COMBAT)
|
||||
{
|
||||
DashButton.gameObject.SetActive(true);
|
||||
}
|
||||
else if (state == GameStateManager.State.NORMAL)
|
||||
{
|
||||
DashButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void DebugLog(string text)
|
||||
{
|
||||
if (debugPrint)
|
||||
|
||||
@@ -233,13 +233,13 @@ namespace Beyond
|
||||
{
|
||||
return !isAttacking && base.JumpConditions();
|
||||
}
|
||||
|
||||
/*
|
||||
protected override bool RollConditions()
|
||||
{
|
||||
return base.RollConditions() && !isAttacking && !cc.animator.IsInTransition(cc.upperBodyLayer) &&
|
||||
!cc.animator.IsInTransition(cc.fullbodyLayer);
|
||||
}
|
||||
|
||||
*/
|
||||
#endregion Conditions
|
||||
|
||||
#region Update Animations
|
||||
@@ -355,20 +355,20 @@ namespace Beyond
|
||||
|
||||
protected override void RollInput()
|
||||
{
|
||||
if (rollInput.GetButtonDown())
|
||||
if (rollInput.GetButtonDown() && RollConditions())
|
||||
{
|
||||
if (horizontalInput.GetAxis() != 0f || verticallInput.GetAxis() != 0f)
|
||||
cc.Roll();
|
||||
/*
|
||||
if (horizontalInput.GetAxis() != 0f && verticallInput.GetAxis() != 0f)
|
||||
{
|
||||
if (RollConditions())
|
||||
{
|
||||
cc.Roll();
|
||||
}
|
||||
cc.Roll();
|
||||
}
|
||||
else
|
||||
{
|
||||
bThirdPersonController beyondController = (bThirdPersonController)cc;
|
||||
beyondController.Dash();
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ namespace Beyond
|
||||
|
||||
public virtual void Dash()
|
||||
{
|
||||
// OnRoll.Invoke();
|
||||
// isRolling = true;
|
||||
OnRoll.Invoke();
|
||||
isRolling = true;
|
||||
|
||||
animator.CrossFadeInFixedTime("Dash", rollTransition, baseLayer);
|
||||
ReduceStamina(rollStamina, false);
|
||||
|
||||
Reference in New Issue
Block a user