public void ShouldStayTest()
    {
        //Arrange
        setUpPositions(new Vector3(0, 0, 0), new Vector3(13, 0, 0));
        //Act
        ChargingAI ai = testAI.GetComponent <ChargingAI>();

        //verify
        Assert.IsFalse(ai.ProcessChargeBehaviour());
    }
    public void IsMovingTest()
    {
        //Arrange
        setUpPositions(new Vector3(0, 0, 0), new Vector3(3, 0, 0));
        //Act
        ChargingAI ai = testAI.GetComponent <ChargingAI>();

        ai.ProcessChargeBehaviour();
        //verify
        Rigidbody2D body = ai.GetComponent <Rigidbody2D> ();

        Assert.IsTrue(body.velocity.x < 0);
    }
Esempio n. 3
0
    public void SpawnMeleeTest()
    {
        //Arrange
        var gameObject = SpawningUtility.SpawnEnemy(Vector3.zero, SpawnableEnemyTypes.TestMeleeEnemy);

        //Act
        ChargingAI chargingAI = gameObject.GetComponent <ChargingAI>();
        FleeingAI  fleeingAI  = gameObject.GetComponent <FleeingAI>();

        //Assert
        Assert.IsTrue(chargingAI != null);
        Assert.IsFalse(fleeingAI != null);
    }
    bool ChargeComplete(StateController controller)
    {
        ChargingAI chargingAI = controller.GetComponent <ChargingAI>();

        if (chargingAI != null)
        {
            return(chargingAI.ChargeComplete());
        }
        else
        {
            Debug.LogWarning("Controller does not have ChargingAI component.");
            return(false);
        }
    }