public void DamagePlayer(int damage) { stats.currentHealth -= damage; if (stats.currentHealth <= 0) { audioManager.PlaySound(deathSoundName); GameMaster.KillPlayer(this); } else { audioManager.PlaySound(gruntSoundName); } statusIndicator.SetHealth(stats.currentHealth, stats.maxHealth); }
private void Effect(Vector3 hitposition, Vector3 normal) { Transform trail = Instantiate(BulletTrailPrefab, firePoint.position, firePoint.rotation) as Transform; LineRenderer lr = trail.GetComponent <LineRenderer>(); if (lr != null) { lr.SetPosition(0, firePoint.position); lr.SetPosition(1, hitposition); } Destroy(trail.gameObject, 0.04f); if (normal != new Vector3(9999, 9999, 9999)) { Transform hitParticle = Instantiate(HitPrefab, hitposition, Quaternion.FromToRotation(Vector3.right, normal)) as Transform; Destroy(hitParticle.gameObject, 1f); } Transform clone = Instantiate(MuzzleFlashPrefab, firePoint.position, firePoint.rotation) as Transform; clone.parent = firePoint; float size = UnityEngine.Random.Range(0.6f, 0.9f); clone.localScale = new Vector3(size, size, size); Destroy(clone.gameObject, 0.02f); camShake.Shake(camShakeAmount, camShakeLength); audioManager.PlaySound(weaponShootSound); }
public void UpgradeHealth() { if (GameMaster.Money < 0) { audioManager.PlaySound("No Money"); return; } audioManager.PlaySound(pressedButtonSound); stats.maxHealth = (int)(stats.maxHealth * healthMultiplier); GameMaster.Money -= upgradeCost; Debug.Log("Upgrading to " + stats.maxHealth.ToString()); audioManager.PlaySound("Money"); UpdateValues(); }
public void StartGame() { audioManager.PlaySound(pressedButtonSound); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); }
public void EndGame() { Debug.Log("End Game"); audioManager.PlaySound(gameOverSound); gameOverUI.SetActive(true); }