| | | 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 first step of the recipe, chopping potatos |
| | | 18 | | /// </summary> |
| | | 19 | | public class RecipeState1 : RecipeBaseState |
| | | 20 | | { |
| | | 21 | | public override void EnterState(RecipeManager rm) |
| | 1 | 22 | | { |
| | 1 | 23 | | base.EnterState(rm); |
| | | 24 | | |
| | | 25 | | // Set text |
| | 1 | 26 | | objective.text = "\nRoughly cut potatoes and place in the pot.\n" + |
| | | 27 | | "(8 chunks - 40g minimum)"; |
| | | 28 | | |
| | 1 | 29 | | status.text = "\n\n\n0 / 8 potato chunks"; |
| | 1 | 30 | | } |
| | | 31 | | |
| | | 32 | | public override void Update() |
| | 1682 | 33 | | { |
| | 1682 | 34 | | numberOfPotatos = potBehaviour.numPotatos; |
| | | 35 | | |
| | 1682 | 36 | | if(numberOfPotatos < 8) |
| | 1682 | 37 | | { |
| | 1682 | 38 | | status.text = "\n\n\n" + numberOfPotatos + " / 8 potato chunks"; |
| | 1682 | 39 | | } |
| | | 40 | | else |
| | 0 | 41 | | { |
| | 0 | 42 | | status.text = "\n\n\n" + numberOfPotatos + " / 8 potato chunks" + |
| | | 43 | | "\n Objective complete!"; |
| | 0 | 44 | | recipeManager.StartCoroutine(MoveToStep2()); |
| | 0 | 45 | | } |
| | 1682 | 46 | | } |
| | | 47 | | |
| | | 48 | | public override void FixedUpdate() |
| | 0 | 49 | | { |
| | | 50 | | // Do nothing |
| | 0 | 51 | | } |
| | | 52 | | |
| | | 53 | | IEnumerator MoveToStep2() |
| | 0 | 54 | | { |
| | 0 | 55 | | yield return new WaitForSeconds(4); |
| | 0 | 56 | | recipeManager.MoveToState(recipeManager.state2); |
| | 0 | 57 | | } |
| | | 58 | | } |