Exemple #1
0
 // Use this for initialization
 void Start()
 {
     destinationSet = false;
     targets        = new GameObject[1];
     targets[0]     = GameObject.Find("Player"); //TODO: jos pelaajia on enemmän, etsi ne kaikki kerralla tähän listaan
     agent          = GetComponent <NavMeshAgent>();
     shootingAI     = GetComponent <ShootingAI>();
 }
Exemple #2
0
    public void PreditionTest()
    {
        //Arrange
        var        gameObject = new GameObject();
        ShootingAI ai         = gameObject.AddComponent <ShootingAI> ();

        //Act
        Vector2 testPredict = ai.PredictFuturePosition(Vector2.zero, Vector2.up, 11);

        Debug.Log(testPredict);
        //Assert
        Assert.IsTrue((testPredict.y > 11.5) && (testPredict.y < 12.5));
    }
Exemple #3
0
    public void SpawnRangedTest()
    {
        //Arrange
        var gameObject = SpawningUtility.SpawnEnemy(Vector3.zero, SpawnableEnemyTypes.TestRangedEnemy);

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

        //Assert
        Assert.IsFalse(chargingAI != null);
        Assert.IsTrue(fleeingAI != null);
        Assert.IsTrue(shootingAI != null);
    }