
- Player Detection and Tracking
- The monster detects the player within a detect range and starts moving toward the player when the player is within range.
- If the player moves beyond the detection range, the monster returns to its starting position and stays idle.
- When the monster reaches the starting position, it should stop and rotate back to its original facing direction.
- Attack Mechanism
- The monster attacks when it gets within the attack range of the player. The attack is triggered by setting the animator parameter.
- Once in attack range, the monster stops moving
- While attacking, the monster doesn’t move towards the player, but it plays an attack animation.
- Animator State Transitions
The script uses animator parameters to transition between different animation states based on the monster’s behavior.
- Collision&Trigger Detection
When the monsters’ hand touches the player, the alpha of a transition object’s material gradually increases from 0 to 1 This effect is achieved using a coroutine that smoothly adjusts the material’s transparency over a set duration. Once the alpha reaches 1, the game transitions to livel GameOver.