示例#1
0
    //Test ability to spawn an enemy when enough points are present
    public void EnemySpawnTest()
    {
        var        gameObject = new GameObject();
        EnemyMaker maker      = gameObject.AddComponent <EnemyMaker>();
        CrabEnemy  enemy      = gameObject.AddComponent <CrabEnemy>();

        maker.Start();
        enemy.Start();
        maker.setCurrentCost(0);
        maker.setMaxCost(10);
        Assert.IsTrue(maker.testIfEnemyMakeable(enemy));
    }
示例#2
0
    //Test for correct behavior (no spawn) when there are not enough points to spawn an enemy.
    public void EnemySpawnNoRoomTest()
    {
        var        gameObject = new GameObject();
        EnemyMaker maker      = gameObject.AddComponent <EnemyMaker>();
        CrabEnemy  enemy      = gameObject.AddComponent <CrabEnemy>();

        maker.Start();
        enemy.Start();
        //Need to force a platform to exist
        maker.setCurrentCost(10);
        maker.setMaxCost(5);
        Assert.IsFalse(maker.testIfEnemyMakeable(enemy));
    }