Mini-Games-Game/Assets/Scripts/StickBeatings/detectionScript.cs
Santi b0be1fdd96 Beating-With-Sticks: Added Rock and RockScript - enemy slows down when hit.
Player can throw rocks at enemy to slow them down.
Enemy script split into two scripts, one for movement and one for detection.
Added and edited some comments.
2024-08-13 12:53:54 +01:00

31 lines
639 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//* General Comments or Finished Tasks
//TODO Tasks left to be done for game
//! Bugs or Issues
//? Questions or Suggestions
//* Detects if player is in range of enemy
public class detectionScript : MonoBehaviour
{
public bool playerInRange = false;
private void OnTriggerEnter(Collider other)
{
if(other.tag == "Player")
{
playerInRange = true;
}
}
private void OnTriggerExit(Collider other)
{
if(other.tag == "Player")
{
playerInRange = false;
}
}
}