예제 #1
0
    public IEnumerator Constructor_PieceObj()
    {
        //Load and instantiate target object
        GameObject targetObj = Object.Instantiate(Resources.Load("1/targetObj") as GameObject);
        //Get instance of script
        BreakingEffect BE = targetObj.GetComponent <BreakingEffect>();

        //Call start to initial scene
        BE.Start();
        //UTPieceClass1
        Assert.AreEqual("Cube1", BE.pieceObj[0].obj.name);
        //UTPieceClass2
        Assert.AreEqual(false, BE.pieceObj[0].onGround);
        //UTPieceClass3
        Assert.AreEqual(50, BE.pieceObj[0].initSpeed);
        //UTPieceClass4
        Assert.AreEqual(-9.8, BE.pieceObj[0].gravity, delta);
        //UTPieceClass5
        Assert.AreEqual(false, BE.pieceObj[0].stop);
        //UTPieceClass6
        Assert.AreEqual(29.41, BE.pieceObj[0].speedLastFrameX, delta);
        //UTPieceClass7
        Assert.AreEqual(9.8, BE.pieceObj[0].speedLastFrameZ, delta);
        yield return(null);
    }
예제 #2
0
    public IEnumerator UTTarObj1()
    {
        //Load and instantiate target object
        GameObject targetObj = Object.Instantiate(Resources.Load("1/targetObj") as GameObject);
        //Get instance of script
        BreakingEffect BE = targetObj.GetComponent <BreakingEffect>();

        //Call start to initial scene
        BE.Start();
        //Test if target object is successfully created by checking count of sub objects.
        Assert.AreEqual(32, targetObj.transform.childCount);
        yield return(null);
    }
예제 #3
0
    public IEnumerator testInitialSpeed()
    {
        //Load and instantiate target object
        GameObject targetObj = Object.Instantiate(Resources.Load("1/targetObj") as GameObject);
        //Get instance of script
        BreakingEffect BE = targetObj.GetComponent <BreakingEffect>();

        //Call start to initial scene
        BE.Start();
        //Test if all piece objects are successfully initialed
        Assert.AreEqual(50, BE.pieceObj[0].initSpeed);
        yield return(null);
    }
예제 #4
0
    public IEnumerator testMotionGround()
    {
        //Load and instantiate target object
        GameObject targetObj = Object.Instantiate(Resources.Load("1/targetObj") as GameObject);
        //Load ground with script
        //Instantiate ground
        GameObject ground = Object.Instantiate(Resources.Load("1/ground") as GameObject);
        //Get instance of script
        BreakingEffect BE = targetObj.GetComponent <BreakingEffect>();

        //Call start to initial scene
        BE.Start();
        //Test displacement on the ground in one frame
        Assert.AreEqual(0.58, BE.pieceObj[0].DisGroCalX(), delta);
        Assert.AreEqual(0.19, BE.pieceObj[0].DisGroCalZ(), delta);
        yield return(null);
    }
예제 #5
0
    public IEnumerator testAngles2()
    {
        //Load and instantiate target object
        GameObject targetObj = Object.Instantiate(Resources.Load("1/targetObj") as GameObject);
        //Get instance of script
        BreakingEffect BE = targetObj.GetComponent <BreakingEffect>();

        //Call start to initial scene
        BE.Start();
        Debug.Log("Explosion point is: " + BE.GetExplosionPoint());
        Debug.Log("Position of pieceObj[1] is: " + BE.pieceObj[1].obj.transform.position);
        Debug.Log("ThetaOne is: " + BE.pieceObj[1].thetaOne);
        Debug.Log("ThetaTwo is: " + BE.pieceObj[1].thetaTwo);
        Assert.AreEqual(0.76, BE.pieceObj[1].thetaOne, delta);
        Assert.AreEqual(0.79, BE.pieceObj[1].thetaTwo, delta);
        yield return(null);
    }
예제 #6
0
    public IEnumerator BETestWithEnumeratorPasses()
    {
        // Use the Assert class to test conditions.
        // yield to skip a frame
        GameObject go1 = Resources.Load("1/targetObj") as GameObject;

        Object.Instantiate(go1);
        //Debug.Log(go1.name);
        go1.name           = "targetObj";
        go1.transform.name = "targetObj";
        //Debug.Log(go1.transform.childCount);
        //Debug.Log(GameObject.FindGameObjectWithTag("targetObj").name);
        //Debug.Log(GameObject.Find("targetObj").name);
        GameObject     ground = Resources.Load("1/ground") as GameObject;
        BreakingEffect BE     = ground.GetComponent <BreakingEffect>();

        BE.Start();
        Assert.AreEqual(32, BE.pieceObj.Length);
        yield return(null);
    }