We’re considering changing the AI for the enemy in our horror game. Here’s the 2 types of AI we can choose from:
Simple AI: The enemy just walks towards the player without stopping.
Slender AI: Only moves when not looking at enemy, player dies if looking at enemy for too long.
The problems with these two types, the simple AI might just ruin the game. It’s called Stalker, but running towards the player probably wouldn’t be considered “stalky”. And for the Slender AI, we haven’t figured out how to make the player die from looking at the enemy.
Not to be “that guy” but this is a question that would be best for the forums because there’s no real answer to this due to it being based solely on opinion.
IF you’re asking how to make the player die by looking at an enemy then that’s completely different, and completely do-able. Even a simple raycast would probably suffice:
float damage = 0; // Damage dealt to the player by looking at the enemy
Transform playerEyes; // Eye-level for the player
float playerHealth = 0; // Current health the player has
float distance = 0; // How far away the character can see
Ray ray = new Ray(playerEyes.position, playerEyes.forward);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, distance))
{
if (hit.transform != null)// If the transform exists
{
if (hit.transform.tag == "Enemy")// If the transform is the enemy
{
playerHealth -= damage; // Apply Damage
}
}
}
To answer the actual presented question, though… it’s impossible to say because I know nothing about your game