-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKnightAI.cs
35 lines (31 loc) · 994 Bytes
/
KnightAI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using BT;
using System.Collections.Generic;
using UnityEngine;
public class KnightAI : BTree
{
public static float speed = 2.0f;
public static float FOVRange = 4.0f;
public static float attackRange = 2.0f;
protected override Node SetupBTree()
{
Node root = new Selector(new List<Node>
{
new Sequence(new List<Node> {
new EnemyInFOVRange(transform),
new GoToTargetAction(transform),
new EnemyInAttackRange(transform),
new AttackAction(transform)
}),
new PatrolAction(transform),
});
return root;
}
// Debug for visualization in scene for FOV/Attack range
private void OnDrawGizmos()
{
Gizmos.color = Color.green;
Gizmos.DrawWireSphere(transform.position, FOVRange);
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(transform.position, attackRange);
}
}