< Summary

Class:RecipeState1
Assembly:Test
File(s):E:/Unity/Unity Project/VR-Cooking-Demo/Assets/_Scripts/Recipe States/RecipeState1.cs
Covered lines:12
Uncovered lines:10
Coverable lines:22
Total lines:58
Line coverage:54.5% (12 of 22)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:4
Method coverage:50% (2 of 4)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
EnterState(...)0%000100%
Update()0%00063.64%
FixedUpdate()0%0000%
MoveToStep2()0%0000%

File(s)

E:/Unity/Unity Project/VR-Cooking-Demo/Assets/_Scripts/Recipe States/RecipeState1.cs

#LineLine coverage
 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
 12using System.Collections;
 13using System.Collections.Generic;
 14using UnityEngine;
 15
 16/// <summary>
 17/// State <c>RecipeState1</c> is the first step of the recipe, chopping potatos
 18/// </summary>
 19public class RecipeState1 : RecipeBaseState
 20{
 21    public override void EnterState(RecipeManager rm)
 122    {
 123        base.EnterState(rm);
 24
 25        // Set text
 126        objective.text = "\nRoughly cut potatoes and place in the pot.\n" +
 27                         "(8 chunks - 40g minimum)";
 28
 129        status.text = "\n\n\n0 / 8 potato chunks";
 130    }
 31
 32    public override void Update()
 168233    {
 168234        numberOfPotatos = potBehaviour.numPotatos;
 35
 168236        if(numberOfPotatos < 8)
 168237        {
 168238            status.text = "\n\n\n" + numberOfPotatos + " / 8 potato chunks";
 168239        }
 40        else
 041        {
 042            status.text = "\n\n\n" + numberOfPotatos + " / 8 potato chunks" +
 43                "\n Objective complete!";
 044            recipeManager.StartCoroutine(MoveToStep2());
 045        }
 168246    }
 47
 48    public override void FixedUpdate()
 049    {
 50        // Do nothing
 051    }
 52
 53    IEnumerator MoveToStep2()
 054    {
 055        yield return new WaitForSeconds(4);
 056        recipeManager.MoveToState(recipeManager.state2);
 057    }
 58}