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)
|
||||
|
||||
Reference in New Issue
Block a user