//------------------------------ // 銃の攻撃 //------------------------------ private void attack01_gun() { if (gunBulletNum <= 0) { return; //残弾がないので } if (targetEnemy != null) //target(敵)が存在すれば { GameObject effect = Instantiate(prefab_hitEffect1, attackPoint, Quaternion.identity) as GameObject; //エフェクト発生 Destroy(effect, 0.2f); //effect削除 targetEnemy.GetComponent <C05_Enemy>().atkDamage(GetComponent <C13_Status>()); // 攻撃した敵が持つ《C05_Enemy》コンポーネントのatkDamege()関数を実行 } c92_Sound.SendMessage("soundStart", gun_sound); // 音を鳴らす gunBulletNum--; c93_UI.changeTextGunNum(gunBulletNum); // UITextの表示を変える if (gunBulletNum <= 0) { StartCoroutine("reChargeGun"); //銃のコルーチン開始 } }
//------------------- // ボムの爆破処理 //------------------- IEnumerator bom() { yield return(new WaitForSeconds(2.5f)); //2.5s処理を待機 GameObject effect = Instantiate(prefab_HitBombEffecf, transform.position, Quaternion.identity) as GameObject; //ボムエフェクト発生 Destroy(effect, 1.0f); //ボムエフェクト1秒後削除 c92Sound.SendMessage("soundStart", bomb_explosion_sound); // ボム攻撃時の音 bombAttack(); Destroy(gameObject); }