|
|
@@ -127,12 +127,16 @@ public class Wolf : TargetAnimal
|
|
|
}
|
|
|
AudioMgr.ins.PlayAnimalEffect("wolf_injured", AudioMgr.GetAudioSource(this.gameObject));
|
|
|
}
|
|
|
+
|
|
|
+ void SetAgentStopped(bool value) { //要捕捉错误,不然会报错
|
|
|
+ try { this.agent.isStopped = value; } catch (System.Exception) {}
|
|
|
+ }
|
|
|
|
|
|
//启动寻路
|
|
|
void SetDestination(Vector3 pos) {
|
|
|
state.ResetActionState();
|
|
|
state.moving = true;
|
|
|
- this.agent.isStopped = false;
|
|
|
+ SetAgentStopped(false);
|
|
|
if (useRunbackPoint) {
|
|
|
useRunbackPoint = false;
|
|
|
WolfActGrid.ins.areaMatrix.releaseOccupy(this);
|
|
|
@@ -147,7 +151,7 @@ public class Wolf : TargetAnimal
|
|
|
//寻路结束
|
|
|
void OnReachDestination() {
|
|
|
if (!state.moving) return;
|
|
|
- this.agent.isStopped = true;
|
|
|
+ SetAgentStopped(true);
|
|
|
state.ResetActionState();
|
|
|
}
|
|
|
//是否已经接近目的地(寻路完成判断)
|
|
|
@@ -455,7 +459,7 @@ public class Wolf : TargetAnimal
|
|
|
void Stay(bool correct = false) {
|
|
|
if (state.moving || correct) {
|
|
|
this.agent.destination = this.agent.nextPosition;
|
|
|
- this.agent.isStopped = true;
|
|
|
+ SetAgentStopped(true);
|
|
|
}
|
|
|
state.ResetActionState();
|
|
|
state.staying = true;
|