| | | 1 | | /* |
| | | 2 | | * |
| | | 3 | | * Code by: |
| | | 4 | | * Dimitrios Vlachos |
| | | 5 | | * djv1@student.london.ac.uk |
| | | 6 | | * dimitri.j.vlachos@gmail.com |
| | | 7 | | * |
| | | 8 | | * Adapted from our Games Dev FSM lecture |
| | | 9 | | * |
| | | 10 | | */ |
| | | 11 | | |
| | | 12 | | using System.Collections; |
| | | 13 | | using System.Collections.Generic; |
| | | 14 | | using UnityEngine; |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// State <c>RecipeState1</c> is the second step of the recipe, chopping carrots |
| | | 18 | | /// </summary> |
| | | 19 | | public class RecipeState2 : RecipeBaseState |
| | | 20 | | { |
| | | 21 | | public override void EnterState(RecipeManager rm) |
| | 0 | 22 | | { |
| | 0 | 23 | | base.EnterState(rm); |
| | | 24 | | |
| | | 25 | | // Set text |
| | 0 | 26 | | objective.text = "\nChop carrot into thin slices.\n" + |
| | | 27 | | "(10 slices - 1g minimum)"; |
| | | 28 | | |
| | 0 | 29 | | status.text = "\n\n\n0 / 10 carrot slices"; |
| | 0 | 30 | | } |
| | | 31 | | |
| | | 32 | | public override void Update() |
| | 0 | 33 | | { |
| | 0 | 34 | | numberOfCarrots = potBehaviour.numCarrots; |
| | | 35 | | |
| | 0 | 36 | | if (numberOfCarrots < 10) |
| | 0 | 37 | | { |
| | 0 | 38 | | status.text = "\n\n\n" + numberOfCarrots + " / 10 carrot slices"; |
| | 0 | 39 | | } |
| | | 40 | | else |
| | 0 | 41 | | { |
| | 0 | 42 | | status.text = "\n\n\n" + numberOfCarrots + " / 10 carrot slices" + |
| | | 43 | | "\n Objective complete!"; |
| | 0 | 44 | | recipeManager.StartCoroutine(MoveToStep3()); |
| | 0 | 45 | | } |
| | 0 | 46 | | } |
| | | 47 | | |
| | | 48 | | public override void FixedUpdate() |
| | 0 | 49 | | { |
| | | 50 | | // Do nothing |
| | 0 | 51 | | } |
| | | 52 | | |
| | | 53 | | IEnumerator MoveToStep3() |
| | 0 | 54 | | { |
| | 0 | 55 | | yield return new WaitForSeconds(4); |
| | | 56 | | //recipeManager.MoveToState(recipeManager.state2); |
| | 0 | 57 | | Debug.Log("Not there yet!"); |
| | 0 | 58 | | } |
| | | 59 | | } |