コード例 #1
0
    public void move_player_offscreen()
    {
        // create the turnswitcher and a player gameobject
        turnswitcher turn   = new turnswitcher();
        GameObject   player = new GameObject();

        player.GetComponent <Transform>().position = new Vector3(100, 0, 100);

        // call the procedure to move the gameobject given off the screen to the pos (0,-200,0)
        turn.moveoffscreen(player);

        float ypos = player.GetComponent <Transform>().position.y;  // save the Y position of the player into the var ypos

        // checks that the new position of the player is (0,-200,0)
        Assert.IsTrue(ypos == -200);
    }
コード例 #2
0
    public void Player_swaptag()
    {
        // set up two players and temp and set the tags to what they would be in the game
        turnswitcher turn       = new turnswitcher();
        GameObject   player1    = new GameObject();
        GameObject   player2    = new GameObject();
        GameObject   tempholder = new GameObject();

        player1.tag    = "Player";
        player2.tag    = "Player2";
        tempholder.tag = "tempplayer";

        // call the procedure swap tags which is called when the turns switch the swap the tags of the players
        turn.swaptags();

        // check that player2 now has the player tag
        Assert.IsTrue(player2.tag == "Player");
    }