-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
brain fried, im gonna cry, creating this game make me wanna fucking die /srs add respawn mechanic and some other stuffs i cant really remember jfc
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class healthPickup : MonoBehaviour | ||
{ | ||
playerHealth healthScript; | ||
public int HealthPU = 30; | ||
public AudioClip healthPickupAudio; | ||
public float AudioVolume = 10f; | ||
private Camera PlayerCamera; | ||
|
||
// Start is called before the first frame update | ||
void Start() | ||
{ | ||
healthScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<playerHealth>(); | ||
PlayerCamera = Camera.main; | ||
} | ||
|
||
private void OnTriggerEnter(Collider other) | ||
{ | ||
if (other.tag == "Player") | ||
{ | ||
if (healthScript.Health < 100) | ||
{ | ||
AudioSource.PlayClipAtPoint(healthPickupAudio, PlayerCamera.gameObject.transform.position, AudioVolume); | ||
healthScript.Health += HealthPU; | ||
Destroy(gameObject); | ||
} | ||
else | ||
{ | ||
return; | ||
} | ||
|
||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.