#Instead of instantiating everything in

1 messages · Page 1 of 1 (latest)

ionic heron
#

oh, cool, I think I see, let me try that

#

Shoot, that gives me a stack overflow, I wonder if I'm messing something up

pine inlet
#

If a strategy ever recursively tries to access itself, it would:

get rush -> no rush -> make rush:
  rush construct -> get wait -> no wait -> make wait:
    wait construct -> get rush !!! recursive construction
ionic heron
#

Yeah, I think that's what's happening, but unfortunately I do need that to happen, because the state machine is cyclical (which is applicable)

pine inlet
#

In that case should probably treat it as a graph. create all the strategies first, then connect them to each other in a second step.

public CharacterStrategyFactory() {
  _strategyDict = new() {
    {"Rush", new CharacterStrategyRush(this)}, // ...
  };

  foreach (var pair in _strategyDict)
    pair.Value.SetTransitions(); // overriden CharacterStrategy method to set _strategyTransitions
}
#

sorry to send you back to what you had before

ionic heron
#

okay, yeah, I guess I have to pull the transition logic outside of the objects

#

haha no it's no worries