Пример #1
0
    public IEnumerator ThirdPersonUserControl_Move_Test_WithEnumeratorPasses()
    {
        UnityEngine.SceneManagement.SceneManager.LoadScene("Untitled");
        SetCharacter.istest = true;
        yield return(null);

        /// init GameObject
        GameObject hero = SetCharacter.hero;

        Assert.AreNotEqual(hero, null);
        hero.transform.position = new Vector3(12, 0, 15);
        hero.transform.rotation = Quaternion.identity;

        /// init script test
        yield return(null);

        ThirdPersonUserControl testcs = hero.GetComponent <ThirdPersonUserControl> ();
        /// move -> forward
        Vector3 pos = hero.transform.position;

        // up arrow
        testcs.Operation_LRUD(0f, 100.0f, true);
        yield return(null); yield return(null);

        yield return(null); yield return(null);

        Assert.Greater(Vector3.Dot(hero.transform.forward, hero.transform.position - pos), 0.0);
        /// move -> rot
        Vector3 forw = hero.transform.forward;

        testcs.Operation_LRUD(10.0f, 0.0f, true);
        Assert.Greater(Vector3.Cross(forw, hero.transform.forward).y, 0.0);

        SetCharacter.istest = false;
    }