void Attack(Damage dmg) { GameObject bullet = Instantiate(bulletPrefab) as GameObject; MagicBullet bulletCom = bullet.GetComponent <MagicBullet> (); Block block = BattleField.GetBlock(dmg.target); bulletCom.Shoot(block.GetCenterPosition()); parent.SendDamage(dmg); }
IEnumerator Attack(Block block, float delay) { yield return(new WaitForSeconds(delay)); GameObject bullet = Instantiate(bulletPrefab) as GameObject; MagicBullet bulletCom = bullet.GetComponent <MagicBullet> (); bulletCom.Shoot(block.GetCenterPosition()); if (block.state == Block.BlockState.Hero) { SendDamage(GetDamage(parent.GetHeroInfo(), block.SimpleBlock), block); } }