public class Effect : Entity
{
Entity source;
[SerializeField]
Trigger trigger;//cant be left null
[SerializeField]
Target[] targets;//can be empty
public virtual void InvokeEffect(Entity _source, Entity[] data)//data is different depending on Trigger attached: f.e. OnCardPlay will recieve reference to played Card. State Machine takes care of it
{
source = _source;
//Possible things in overrides:
//-Call arbiter functions:
//--DoDmg
//--Move
//--Kill
//--Heal
//--Spawn
//--EndTurn
//--PlayCard
//--Check targets - this ends the function and then, after user selects a valid target, arbiter calls this function again. It needs to start where it left off tho
//If no possible targets are available, NoTargetablesException() is called instead and we enter a different branch of this method
}
public virtual void NoTargetablesException()
{
}
}
Mam funkcję, która może(ale nie musi, bo jest wirtualna) zadać użytkownikowi pytanie o target, na którym będzie się coś działo, jednak wtedy funkcja przestaje być wykonywana, i coś z zewnątrz wywołuje ją ponownie jak tylko valid target zostanie znaleziony. Funkcja powinna wtedy kontynuować się tam, gdzie ostatnio skończyła. W jaki sposób można to zrobić uniwersalnie?