コード例 #1
0
ファイル: PlayerScript.cs プロジェクト: GDR2014/february-Math
 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();
 }