crypod added
This commit is contained in:
39
Assets/Scripts/Enemies/AI/AIStateMachine.cs
Normal file
39
Assets/Scripts/Enemies/AI/AIStateMachine.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using EnemyAI;
|
||||
/*
|
||||
# Enemy System
|
||||
## States
|
||||
1. **Passive**
|
||||
- Enemy is unaware of danger and performing idle actions. Not actively searching for anything.
|
||||
- Perception range is at its minimum.
|
||||
- If agressive target is "visible" enter `Agressive` state.
|
||||
- If nonagressive target is "visible" enter `Aware` state.
|
||||
2. **Guard**
|
||||
- Enemy is looking out for danger. Can be moving along a path or standing
|
||||
- Perception range is at regular level.
|
||||
- If aggressive target is "visible" enter `Agressive` state.
|
||||
- If nonagressive target is "visible" enter `Aware` state.
|
||||
3. **Aware**
|
||||
- Enemy has noticed something and is moving towards location of interest.
|
||||
- Peception range is at regular level.
|
||||
- If player is "visible" enter `Agressive` state.
|
||||
- If nonagresive target is "visible" of equal or greater importance change target.
|
||||
- If at location and no new item of note is added to "visible", then enter either `Passive` or `Guard` mode based on original mode.
|
||||
4. **Aggressive**
|
||||
- Enemy has noticed player:
|
||||
- Apply these actions in sequence:
|
||||
a. If player has not been "visible" for more than 5 seconds enter `Guard` mode.
|
||||
b. If player has not been "visible" for < 5 seconds move to last location it was visible.
|
||||
c. If player is in attack range and is visible, stop moving, and attack if able.
|
||||
d. If player is not in attack range and is visible, run in direction of player.
|
||||
|
||||
|
||||
*/
|
||||
class AIStateMachine : MonoBehaviour{
|
||||
[SerializeField]
|
||||
private EnemyState state;
|
||||
|
||||
|
||||
|
||||
}
|
11
Assets/Scripts/Enemies/AI/AIStateMachine.cs.meta
Normal file
11
Assets/Scripts/Enemies/AI/AIStateMachine.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecb02583e05945c42b91880d7bb76fec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
12
Assets/Scripts/Enemies/AI/EnemyState.cs
Normal file
12
Assets/Scripts/Enemies/AI/EnemyState.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace EnemyAI{
|
||||
///The state the enemy is currently in.
|
||||
///Passive: Enemy is not searching for anyone and is at minimum perception distance.
|
||||
///Guard: Enemy is on the lookout for enemies. May be following a patrol path.
|
||||
///Aware: Enemy has noticed something and is investigating it.
|
||||
///Aggressive: Enemy has seen something it wants to attack and is performing its attack.
|
||||
public enum EnemyState{PASSIVE, GUARD, AWARE, AGGRESSIVE};
|
||||
|
||||
|
||||
}
|
11
Assets/Scripts/Enemies/AI/EnemyState.cs.meta
Normal file
11
Assets/Scripts/Enemies/AI/EnemyState.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb7c23d6f892d824ebcd580774822eff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user