public IEnumerator TestDestroyPickupEdgeCollider()
    {
        gameScene.DebugSpawnProjectile(new Vector3(0, 0, 0));
        checkDestroyedPickupAmt = gameScene.destroyedPickup;
        debugSpawnMagnetTarget  = (GameObject)gameScene.DebugSpawnMagnetTarget(new Vector3(0, 0, 0));
        yield return(new WaitForSeconds(1f));

        //checkDestroyedPickupAmt = GameObject.Find("GameScene").GetComponent<GameSceneScript>;
        Debug.Log("Verifying previous amt " + checkDestroyedPickupAmt + " with " + gameScene.destroyedPickup);
        Debug.Log("(PlayTest) - TestDestroyPickupEdgeCollider: " + GameSceneScript.GetDestroyedPickupAmt());
        Assert.True(gameScene.destroyedPickup > checkDestroyedPickupAmt);
    }
    public IEnumerator TestDestroyPickupWithBoxCollider()
    {
        gameScene.DebugSpawnBoxProjectile(new Vector3(0, 0, 0));
        checkDestroyedPickupAmt = gameScene.destroyedPickup;
        debugSpawnPickup        = (GameObject)gameScene.DebugSpawnPickup(new Vector3(0, 0, 0));
        yield return(new WaitForSeconds(1f));

        Debug.Log("(PlayTest) - BoxColider - Verifying previous amt " + checkDestroyedPickupAmt + " with " + gameScene.destroyedPickup);

        Debug.Log("(PlayTest-BoxCollider) - GetDestroyedPickup: " + GameSceneScript.GetDestroyedPickupAmt());
        Assert.True(gameScene.destroyedPickup > checkDestroyedPickupAmt);
        yield return(new WaitForSeconds(1f));
    }
    public IEnumerator TestEdgeCollider()
    {
        debugSpawnBoxProjectile = (GameObject)gameScene.DebugSpawnBoxProjectile(new Vector3(5, 0, 0));
        checkDestroyedPickupAmt = gameScene.destroyedPickup;
        debugSpawnPickup        = (GameObject)gameScene.DebugSpawnPickup(new Vector3(0, 0, 0));
        Debug.Log("(PlayTest - TestEdgeCollider - Before) - Verifying previous amt " + checkDestroyedPickupAmt + " with " + gameScene.destroyedPickup);

        Debug.Log("(PlayTest - TestEdgeCollider - Before) - GetDestroyedPickup: " + GameSceneScript.GetDestroyedPickupAmt());
        Assert.False(gameScene.destroyedPickup > checkDestroyedPickupAmt);
        BoxCollider2D col = debugSpawnBoxProjectile.gameObject.GetComponent <BoxCollider2D>();

        col.edgeRadius = 5;
        yield return(new WaitForSeconds(1f));

        Debug.Log("(PlayTest - TestEdgeCollider - After) - Verifying previous amt " + checkDestroyedPickupAmt + " with " + gameScene.destroyedPickup);

        Debug.Log("(PlayTest - TestEdgeCollider - After) - GetDestroyedPickup: " + GameSceneScript.GetDestroyedPickupAmt());
        Assert.True(gameScene.destroyedPickup > checkDestroyedPickupAmt);
    }
    public IEnumerator TestColliderOffset()
    {
        debugSpawnCircleProjectile = (GameObject)gameScene.DebugSpawnProjectile(new Vector3(0, 0, 0));
        checkDestroyedPickupAmt    = gameScene.destroyedPickup;
        CircleCollider2D col = debugSpawnCircleProjectile.gameObject.GetComponent <CircleCollider2D>();

        col.offset = new Vector2(10, 0);

        debugSpawnPickup = (GameObject)gameScene.DebugSpawnPickup(new Vector3(0, 0, 0));
        Debug.Log("(PlayTest - ExpandBoxCollider - Before) - Verifying previous amt " + checkDestroyedPickupAmt + " with " + gameScene.destroyedPickup);

        Debug.Log("(PlayTest - ExpandBoxCollider - Before) - GetDestroyedPickup: " + GameSceneScript.GetDestroyedPickupAmt());
        Assert.False(gameScene.destroyedPickup > checkDestroyedPickupAmt);

        col.offset = new Vector2(0, 0);
        yield return(new WaitForSeconds(1f));

        Debug.Log("(PlayTest - ExpandBoxCollider - After) - Verifying previous amt " + checkDestroyedPickupAmt + " with " + gameScene.destroyedPickup);

        Debug.Log("(PlayTest - ExpandBoxCollider - After) - GetDestroyedPickup: " + GameSceneScript.GetDestroyedPickupAmt());
        Assert.True(gameScene.destroyedPickup > checkDestroyedPickupAmt);
    }
    public IEnumerator TestColliderTile()
    {
        debugSpawnBoxProjectile = (GameObject)gameScene.DebugSpawnBoxProjectile(new Vector3(5, 0, 0));
        checkDestroyedPickupAmt = gameScene.destroyedPickup;
        debugSpawnWeightTarget  = (GameObject)gameScene.DebugSpawnWeightTarget(new Vector3(0, 0, 0));
        yield return(new WaitForSeconds(1f));

        Debug.Log("(PlayTest - TestColliderOffset - Before) - Verifying previous amt " + checkDestroyedPickupAmt + " with " + gameScene.destroyedPickup);
        Debug.Log("(PlayTest - TestColliderOffset - Before) - GetDestroyedPickup: " + GameSceneScript.GetDestroyedPickupAmt());
        Assert.False(gameScene.destroyedPickup > checkDestroyedPickupAmt);

        // weightTracker prefab is pre-saved with auto-tile on boxCollider2D
        SpriteRenderer spriteRenderer = debugSpawnWeightTarget.gameObject.GetComponent <SpriteRenderer>();

        spriteRenderer.drawMode = SpriteDrawMode.Tiled;
        spriteRenderer.size     = new Vector2(10, 10);
        yield return(new WaitForSeconds(1f));

        Debug.Log("(PlayTest - TestColliderTile - After) - Verifying previous amt " + checkDestroyedPickupAmt + " with " + gameScene.destroyedPickup);

        Debug.Log("(PlayTest - TestColliderTile - After) - GetDestroyedPickup: " + GameSceneScript.GetDestroyedPickupAmt());
        Assert.True(gameScene.destroyedPickup > checkDestroyedPickupAmt);
    }
Exemple #6
0
 // Update is called once per frame
 void Update()
 {
     collisionValue.text = GameSceneScript.GetDestroyedPickupAmt().ToString();
     triggerValue.text   = GameSceneScript.GetTriggerCount().ToString();
 }