Example #1
0
        public IEnumerator _11RangedEnemyProjectileHasCorrectLocalScaleRight()
        {
            necromancerObject = Spawner.SpawnNecromancer(0, 0.3f);
            necromancer       = necromancerObject.GetComponent <RangedEnemyController>();
            yield return(null);

            necromancer.FireProjectile();
            yield return(null);

            var necromancerProjectile = GameObject.Find("NecromancerProjectile(Clone)");

            Assert.AreEqual(necromancerProjectile.transform.localScale.x, necromancerObject.transform.localScale.x);
        }
Example #2
0
        public IEnumerator _10RangedEnemyShootProjectile()
        {
            necromancerObject = Spawner.SpawnNecromancer(0, 0.5f);
            necromancer       = necromancerObject.GetComponent <RangedEnemyController>();
            yield return(null);

            necromancer.FireProjectile();
            yield return(null);

            var necromancerProjectile = GameObject.Find("NecromancerProjectile(Clone)");

            Assert.IsNotNull(necromancerProjectile);
        }
Example #3
0
    private void Start()
    {
        if (meleeEnemy)
        {
            melee = gameObject.GetComponentInParent <MeleeEnemyController>();
        }

        if (rangedEnemy)
        {
            ranged = gameObject.GetComponentInParent <RangedEnemyController>();
        }

        if (kultist)
        {
            kk = gameObject.GetComponentInParent <KultistController>();
        }
    }
Example #4
0
        public IEnumerator _13RangedEnemyProjectileDisappearsWhenFar()
        {
            necromancerObject = Spawner.SpawnNecromancer(0, 0.5f);
            necromancer       = necromancerObject.GetComponent <RangedEnemyController>();
            yield return(null);

            necromancer.FireProjectile();
            yield return(null);

            var necromancerProjectile = GameObject.Find("NecromancerProjectile(Clone)");

            Assert.IsNotNull(necromancerProjectile);

            necromancerProjectile.transform.position = new Vector3(101, 0, 0);
            yield return(null);                                              //for update() to run

            Assert.IsTrue(necromancerProjectile == null);
        }
Example #5
0
        public IEnumerator _09RangedMoveAwayFromPlayerAtCorrectSpeed()
        {
            playerObject      = Spawner.SpawnPlayer(-1, 0.5f);
            necromancerObject = Spawner.SpawnNecromancer(0, 0.5f);
            necromancer       = necromancerObject.GetComponent <RangedEnemyController>();

            var originalNecromancerXPos = necromancer.GetPosition().x;

            Assert.AreEqual(originalNecromancerXPos, 0);
            Debug.Log("First assert passed");

            yield return(new WaitForSeconds(1.0f));  //It should move towards (24,?) where the player is

            var newNecromancerXPos = necromancer.GetPosition().x;

            Debug.Log(newNecromancerXPos);
            var expectedXPos = originalNecromancerXPos + necromancer.baseSpeed * necromancer.backwardsSpeedMod;

            Assert.IsTrue(newNecromancerXPos > expectedXPos - 0.1 && newNecromancerXPos < expectedXPos + 0.1);    //speed should be slower than the original speed so the plaeyr can ctach up more easily
        }
Example #6
0
    //if the projectile collides with something
    private void OnCollisionEnter2D(Collision2D collision)
    {
        EnemyController       enemy       = collision.gameObject.GetComponent <EnemyController>();
        RangedEnemyController rangedEnemy = collision.gameObject.GetComponent <RangedEnemyController>();
        BossController        boss        = collision.gameObject.GetComponent <BossController>();

        if (enemy != null)
        {
            enemy.TakeDamage(-projectileDamage);
        }
        if (rangedEnemy != null)
        {
            rangedEnemy.TakeDamage(-projectileDamage);
        }
        if (boss != null)
        {
            boss.TakeDamage(-projectileDamage);
        }

        //destory the game objects after they collided
        Destroy(gameObject);
    }
Example #7
0
    //OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        RangedEnemyController enemy = animator.gameObject.GetComponent <RangedEnemyController>();

        enemy.StartChasing();
    }
 // Use this for initialization
 void Start()
 {
     rangedController = this.GetComponentInParent <RangedEnemyController>();
 }
Example #9
0
 private void Start()
 {
     parentController = GetComponentInParent <RangedEnemyController>();
 }