Esempio n. 1
0
 IEnumerator ChargeTowardsAndDestroy( EnemyScript enemy )
 {
     PlayClip(AttackClip);
     Vector2 pos = transform.position;
     while ( Mathf.Abs( pos.x - enemy.transform.position.x ) > ATTACK_THRESHOLD ) {
         // TODO: Use tweening to give the animation some personality
         pos.x = Mathf.MoveTowards( pos.x, enemy.transform.position.x, ATTACK_SPEED );
         transform.position = pos;
         yield return null;
     }
     attackNumber = enemy.attackTarget;
     enemyManager.RemoveEnemy(enemy);
     PlayClip(ScoreClip);
     scoreManager.Score++;
     enemy.Recycle();
 }