It's easy to add your own actions. In this example, we'll add an action called "Win Game". It assumes you have a manager script named GameManager defined roughly like this:
Code: Select all
public class GameManager : MonoBehaviour
{
public static GameManager Instance {get; set;}
public void WinGame()
{
// Your code here to set the game to the winning state.
}
...
- Duplicate the file QuestActionTemplate.cs located in the Templates folder. Move it into your own scripts folder and rename it to WinGameQuestAction.cs.
- Open the script and rename the class to the same name (WinGameQuestAction).
- Configure the Execute method to call the GameManager's WinGame() method. Example:
Code: Select all
public class WinGameQuestAction : QuestAction { public override void Execute() { base.Execute(); GameManager.Instance.WinGame(); } }
- Now you can select your new Win Game action from the dropdown menu in your quests' Actions sections.