public IEnumerator ChronologicalStateTest() // to check the states go in chronological order
    {
        SceneManager.LoadScene("7-injection", LoadSceneMode.Single);

        yield return(null);

        InjectionGameScript igs = GameObject.Find("GameHandler").GetComponent <InjectionGameScript>();
        bool success            = igs.ChangeState(InjectionGameScript.State.APPLY_CREAM);

        yield return(new WaitForSeconds(0.25f));

        success = igs.ChangeState(InjectionGameScript.State.MOVE_SYRINGE);

        yield return(new WaitForSeconds(0.25f));

        success = igs.ChangeState(InjectionGameScript.State.INJECT_SYRINGE);

        yield return(new WaitForSeconds(0.25f));

        success = igs.ChangeState(InjectionGameScript.State.DONE);

        yield return(new WaitForSeconds(0.25f));

        Assert.IsTrue(success);
    }
Beispiel #2
0
    // Functions concerned with clicking objects

    private void OnClickCreamLid()
    {
        cream.layer = 0;
        bool success = injectionGameScript.ChangeState(InjectionGameScript.State.APPLY_CREAM);

        if (success)
        {
            gameObject.GetComponent <Animation>().Play();
        }
    }
    [Test] // to check that it does go from OPEN_CREAM to APPLY_CREAM
    public void GoesToCorrectStateFromStart()
    {
        EditorSceneManager.OpenScene("Assets/Scenes/7-injection.unity", OpenSceneMode.Single);

        InjectionGameScript igs = GameObject.Find("GameHandler").GetComponent <InjectionGameScript>();
        bool success            = igs.ChangeState(InjectionGameScript.State.APPLY_CREAM);

        Assert.IsTrue(success);
    }
    [Test] // to see that it does not go to DONE straight away
    public void DoesNotGoToDoneStateImmediately()
    {
        EditorSceneManager.OpenScene("Assets/Scenes/7-injection.unity", OpenSceneMode.Single);

        InjectionGameScript igs = GameObject.Find("GameHandler").GetComponent <InjectionGameScript>();
        bool success            = igs.ChangeState(InjectionGameScript.State.DONE);

        Assert.IsFalse(success);
    }