示例#1
0
    public IEnumerator ThirdPersonUserControl_Attack_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;

        GameObject enemy = SetCharacter.enemy;

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

        hero.transform.LookAt(enemy.transform);
        /// init script test
        yield return(null);

        ThirdPersonUserControl testcs = hero.GetComponent <ThirdPersonUserControl> ();
        float hp = enemy.GetComponent <attribute> ().HP;

        Debug.Log(enemy.GetComponent <attribute> ().HP);
        testcs.Operation_J();
        yield return(null); yield return(null);

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

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

        // damage
        Assert.Greater(hp, enemy.GetComponent <attribute> ().HP);

        SetCharacter.istest = false;
    }