moved bucket to the playercontroller, changed tweenStages to a list of pegactions, so processtween takes in actions and builds off of that so that movement/actions priority will line up properly. change tweenstages key to be priority:loop. added category to actions to divide into movement vs action
This commit is contained in:
@@ -8,11 +8,6 @@ public partial class Peg : HoverableNode
|
||||
[Signal]
|
||||
public delegate void DeathEventHandler(Peg THIS);
|
||||
public int _id, _health = 2, _healthMax = 2, _stamina, _staminaRemaining, _visibility = 4, _movement = 0, _disposition;
|
||||
public Dictionary<string, int> _priorities = new()
|
||||
{
|
||||
{"act", 1000000}, // 1000000 to 1999999 reserved for action priorities
|
||||
{"movement", 0} // 0 to 999999 reserved for movement priorities
|
||||
};
|
||||
public Vector2I _address;
|
||||
public List<Vector2I> _path = new();
|
||||
public PegController _pegController;
|
||||
@@ -30,7 +25,7 @@ public partial class Peg : HoverableNode
|
||||
base._Ready();
|
||||
_actions = [.. GetNode<Node2D>("Actions").GetChildren().Cast<PegAction>()];
|
||||
}
|
||||
public virtual bool Act(int SUB_STEP)
|
||||
public virtual PegAction SelectAction()
|
||||
{
|
||||
PegAction action = null;
|
||||
for (int i = 0; i < _actions.Count; i++)
|
||||
@@ -43,17 +38,11 @@ public partial class Peg : HoverableNode
|
||||
}
|
||||
if (action == null)
|
||||
{
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
Tween subtween = action.CreateAnimation(this);
|
||||
string key = action._priority + ":" + SUB_STEP ;
|
||||
if (!_pegController._tweenStages.ContainsKey(key))
|
||||
{
|
||||
_pegController._tweenStages[key] = new();
|
||||
}
|
||||
_pegController._tweenStages[key].Add(subtween);
|
||||
|
||||
_staminaRemaining -= action._cost;
|
||||
return true;
|
||||
return action;
|
||||
}
|
||||
|
||||
public virtual void CounterAct(Commander COMMANDER)
|
||||
|
||||
Reference in New Issue
Block a user