|
|
@@ -21,8 +21,19 @@ public class Wolf : TargetAnimal
|
|
|
{
|
|
|
initAniListener();
|
|
|
InitAutoStrategy();
|
|
|
+ this.agent.avoidancePriority = avoidancePriority;
|
|
|
+ }
|
|
|
+ static int _avoidancePriority = 0;
|
|
|
+ static int avoidancePriority {
|
|
|
+ get {
|
|
|
+ if (_avoidancePriority < 50) {
|
|
|
+ _avoidancePriority++;
|
|
|
+ } else {
|
|
|
+ _avoidancePriority = 1;
|
|
|
+ }
|
|
|
+ return _avoidancePriority;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
|
|
|
void Update()
|
|
|
{
|
|
|
@@ -231,15 +242,16 @@ public class Wolf : TargetAnimal
|
|
|
string canAttackID = null;
|
|
|
void RunToAttackHunter() {
|
|
|
float needDistance;
|
|
|
- if (Random.value < 0.33f) {
|
|
|
- needDistance = 2;
|
|
|
- canAttackID = "B";
|
|
|
- } else {
|
|
|
+ Vector3 displace = animalsBaseT.forward;
|
|
|
+ // if (Random.value < 0.33f) {
|
|
|
+ // needDistance = 2;
|
|
|
+ // canAttackID = "B";
|
|
|
+ // } else {
|
|
|
+ displace = Quaternion.AngleAxis(Random.Range(-30f, 30f), Vector3.up) * displace;
|
|
|
needDistance = 8;
|
|
|
canAttackID = "A";
|
|
|
- }
|
|
|
- Vector3 standardPointer = animalsBaseT.forward;
|
|
|
- Vector3 newPos = animalsBaseT.position + standardPointer * needDistance;
|
|
|
+ // }
|
|
|
+ Vector3 newPos = animalsBaseT.position + displace * needDistance;
|
|
|
SetDestination(newPos);
|
|
|
state.moveQuickly = true;
|
|
|
agent.speed = 5f;
|