This is extra but I added a selection for the enemy like so to go off at the same time:
public struct MPSelectionInfo
{
public int MPAvailable;
public int enemyMPAvailable;
public Action<int> callback;
public Action<int> enemyCallback;
}
public void RequestMPCost(Action<int> callback, Action<int> enemyCallback)
{
if (OnMPSelectionNeeded == null)
{
callback?.Invoke(0);
enemyCallback?.Invoke(0);
return;
}
if (TurnSystem.Instance.IsPlayerTurn())
{
//Player turn use shooting unit is selected and target is enemy
OnMPSelectionNeeded?.Invoke(this, new MPSelectionInfo()
{
callback = callback,
enemyCallback = enemyCallback,
MPAvailable = selectedUnit.GetMagicPoints(),
enemyMPAvailable = targetUnit.GetMagicPoints()
});
}
else
{
OnMPSelectionNeeded?.Invoke(this, new MPSelectionInfo()
{
callback = callback,
enemyCallback = enemyCallback,
MPAvailable = targetUnit.GetMagicPoints(),
enemyMPAvailable = selectedUnit.GetMagicPoints()
});
}
}
This all seems to be fine except it runs into a problem here in the ShootAction:
case State.Aiming:
state = State.Choosing;
stateTimer = 0.1f;
UnitActionSystem.Instance.RequestMPCost(ConfirmMPCost);
break;
private void ConfirmMPCost(int value, int num)
{
Debug.Log($"MP = {value} and EnemyMP = {num}");
NextState();
}
My question is why can’t I use two values in RequestMPCost? It says
There is no argument given that corresponds to the required formal parameter 'enemyCallback' of 'UnitActionSystem.RequestMPCost(Action<int>, Action<int>)'
Why is that? I thought I set it up the same way.