HatCatter/Assets/Scripts/Player.cs

30 lines
675 B
C#

using Unity.VisualScripting;
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour
{
public GameManager gm;
public Rigidbody rb;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
// GameManager gm = FindAnyObjectByType<GameManager>();
Rigidbody rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void OnCollisionEnter(Collision collider) {
if (collider.collider.tag == "Damage") {
Debug.Log("Hit!");
gm.currentHealth -= 5;
}
}
void FixedUpdate()
{
}
}