first commit

This commit is contained in:
2026-05-25 23:10:02 +03:00
commit c9b9947a9c
127 changed files with 31887 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
using UnityEngine;
public class HealthPack : MonoBehaviour
{
public int healAmount = 35;
public float rotateSpeed = 70f;
public float bobHeight = 0.15f;
public float bobSpeed = 2f;
private Vector3 _basePosition;
private void Start()
{
_basePosition = transform.position;
}
private void Update()
{
transform.Rotate(Vector3.up, rotateSpeed * Time.deltaTime, Space.World);
transform.position = _basePosition + Vector3.up * (Mathf.Sin(Time.time * bobSpeed) * bobHeight);
}
private void OnTriggerEnter(Collider other)
{
PlayerHealth playerHealth = other.GetComponent<PlayerHealth>() ?? other.GetComponentInParent<PlayerHealth>();
if (playerHealth != null && playerHealth.Heal(healAmount))
{
Destroy(gameObject);
}
}
}