コード例 #1
0
 // 自機の弾の当たり判定
 public void OnHitEnemyBullet(Collider2D collider)
 {
     if (explosion != null)
     {
         Instantiate(explosion, transform.position, explosion.transform.rotation);
     }
     sm.Addscore(scoreValue);
     Destroy(gameObject);
     Destroy(collider.gameObject);
 }
コード例 #2
0
        IEnumerator OnHitBullet()
        {
            // 爆発エフェクト再生
            Instantiate(explosion, transform.position, explosion.transform.rotation, transform);
            // スコア加点
            sm.Addscore(scoreValue);
            yield return(new WaitForSeconds(3));

            // 敵機を削除
            Destroy(gameObject);
        }
コード例 #3
0
 public void OnHitBullet(Collider2D collision)
 {
     // 弾を削除
     Destroy(collision.gameObject);
     // 爆発エフェクトを生成
     if (explosion != null)
     {
         Instantiate(explosion, transform.position, explosion.transform.rotation);
     }
     // スコア
     sm.Addscore(scoreValue);
     // 敵機を削除
     Destroy(gameObject);
 }
コード例 #4
0
 // 自機の弾の当たり判定
 public void OnHitEnemyBullet(Collider2D collider)
 {
     // 爆発エフェクトの処理
     if (explosion != null)
     {
         Instantiate(explosion, transform.position, explosion.transform.rotation);
     }
     // スコア
     sm.Addscore(scoreValue);
     // プレイヤーの弾
     Destroy(gameObject);
     // 敵の弾
     Destroy(collider.gameObject);
 }