Skip to content

Add boolean change and T flip-flop evaluatable#2072

Merged
diogotr7 merged 3 commits intoantonpup:devfrom
Wibble199:feature/more-evaluatables
Jun 8, 2020
Merged

Add boolean change and T flip-flop evaluatable#2072
diogotr7 merged 3 commits intoantonpup:devfrom
Wibble199:feature/more-evaluatables

Conversation

@Wibble199
Copy link
Collaborator

This PR adds two new evaluatables:

  • A boolean change detector that works similarly to the numeric change detector. Will output a true signal on the frame that the child evaluatable value changes. Can be configured to only output when the new value is true or when the new value is false.
  • A toggle flip-flop whose state changes every frame that the input evaluatable is true.

The existing "Flip-Flop" (Boolean_Latch) has been renamed to "Flip-Flop (Set-Reset)" (Boolean_FlipFlopSR) to clarify the type of latch it behaves as.

Wibble199 added 2 commits June 6, 2020 22:07
…es the state if that boolean is true.

Renamed `Boolean_Latch` to `Boolean_FlipFlopSR`.
@Wibble199 Wibble199 changed the base branch from master to dev June 6, 2020 21:23
public Boolean_FlipFlopT(Evaluatable<bool> toggle) => Toggle = toggle;

protected override bool Execute(IGameState gameState) {
if (Toggle.Evaluate(gameState))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should only toggle if it got false since last toggle. I know you can "fix" it with the boolean change detector but I still think this change should be done. Everyone that worked with graphical programming before will expect it works like that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the current approach makes the most sense and is the most flexible. I don't consider adding a change detector to be a 'fix', for both options to be available, you'd need to add something one way or the other. This way it's more clear what each evaluatable does.

@diogotr7 diogotr7 merged commit 05c5d3c into antonpup:dev Jun 8, 2020
@Wibble199 Wibble199 deleted the feature/more-evaluatables branch June 8, 2020 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants