Game Logic Integration
TutorialMAX is designed to be extensible in almost every way. Here are some of the scenarios where you can integrate your game logic with TutorialMAX:
Scenarios
1. State Behavior
For example,
- If you want to restart part of the game if a tutorial step fails,
- If you want to give 100 coins if a step is finished successfully,
- If you want to lock/unlock areas as the player goes through the tutorial,
public class GiveCoinRewardStateBehavior : TutorialMax.TutorialStateBehaviorBase
{
[SerializeField]
private CurrencyManager _currencyManager;
public int Coins = 100;
protected override void Activate()
{
_currencyManager.AddCoins(Coins);
}
protected override void Deactivate()
{
_currencyManager.SubtractCoins(Coins);
}
}
You don't have to implement the Deactivate method.
However, it's strongly recommended that you do so to make sure the state behavior is responsive to the status of
the tutorial step properly and reliably.
2. Pass Condition
Imagine a scenario where you have a ScoreManager singleton that keeps track of player's score. You can test if a minimum score is reached and pass that step with a script like the following:
public class MinScoreCondition : TutorialMax.TutorialPassConditionBase
{
public int TargetScore = 10;
protected override void OnActivate()
{
ScoreManager.Instance.OnScoreChanged.AddListener(InvokeChanged);
}
protected override void OnDeactivate()
{
ScoreManager.Instance.OnScoreChanged.RemoveListener(InvokeChanged);
}
protected override bool TestPassing()
{
return ScoreManager.Instance.Score >= TargetScore;
}
}