private void FireBullet() { if (bulletStockpile.GetBulletCount() >= damage) { bulletStockpile.IncrementBulletCount(-damage); GameObject newBullet = Instantiate(_bulletPrefab, transform.position, Quaternion.identity); newBullet.GetComponent <BulletBehavior>().SetDamage(damage); timeTillShoot = 1 / rof; FireMultishot(); } }
public void BuyUpgrade() { int bulletCount = _bulletStockpile.GetBulletCount(); if (bulletCount >= _cost) { soundController.playUpgrade(); _bulletStockpile.IncrementBulletCount(-_cost); _cost = (int)(_cost * _costIncreaseRate); costText.text = getCostText(); GainBenefit(); } }
public void TakeDamage(float damage) { Camera.main.GetComponent <CamShaker>().tinyShake(); soundController.playTinyHit(); ParticleSystem.MainModule ps = Instantiate(Explosion, transform.position, Quaternion.identity).GetComponent <ParticleSystem>().main; ps.startColor = ExpColor; if (health > damage) { // enemyRenderer.color = Color.red; // Invoke("ClearRed", 0.15f); health -= (int)damage; } else { bulletStockpile.IncrementBulletCount(bulletScrap); Destroy(gameObject); } }