HatCatter/Assets/Scripts/Player.cs

34 lines
805 B
C#
Executable File

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;
}
if (collider.collider.tag == "Kill") {
Debug.Log("Zing! Killed");
gm.currentHealth = 0;
}
}
void FixedUpdate()
{
}
}