CorePuzzleLogic

This is the core class for the Logic elements. This means that the subclasses of this component also have all properties and methods that are present in here. Make use of it.

Default

As soon as you add the component to the game object, you will need to assign a few fields in the inspector view.

The first field is an array of all triggers that are related to the system.

Two other properties define the auto resets of the system when the puzzle is solved or failed. In other words, whether or not the puzzle needs to reset all triggers and the logic system in these cases.

There are a few public readonly properties that can be accessed from outside of the component/system:

  • bool IsSolved -- is the puzzle in the solved state?

  • bool IsFailed -- is the puzzle in the failed state?

  • bool IsAutoResetSolution -- will the puzzle be auto reset on solved?

  • bool IsAutoResetFailure -- will the puzzle be auto reset on failure?

There are a few public methods that you can also makes use of:

Inheritance

Unlike the CorePuzzleHandler, this class more likely needs to be extended. By default, it has a very simple logic. In order to solve it, the player must just activate all triggers.

By inheriting this class, you will get access to a few useful protected fields:

  • CorePuzzleHandler handler -- the reference to the handler entity.

  • int completedSteps -- the count of the successfuly completed steps. It might be used for comparing it to a total number of triggers, and if they are equal, the puzzle is solved.

There are multiple methods that can be overridden:

Example on how to safely override Awake:

Last updated

Was this helpful?