NPC Wandering Intervals/Gaps Help!
Im using the simple wander script from the community Wiki
http://wiki.unity3d.com/index.php/Wander
for a kitten character. The kitten character has animations such as idle, meow , and walking. There is a sequence for these animations. I want the cat to Wander only when the ongoing animation is 'walking'. I want intervals between the wandering where idle animations can take place. I dont want the kitten to infinitely keep walking.
The Pseudo code i suppose would be: If current animation is "walking", then execute 'wander'.
But how would you edit the code to make this happen? Im not so good with the code yet. Ill get better! Please, help would be appreciated! I am using the C# version.
First remove the StartCoroutine(NewHeading()); from the Awake() function and only call it if in Walk mode so again pseudocode :
if(animation == "Walk" && !isWandering)
{
isWandering = true;
StartCoroutine(NewHeading());
}
else if(isWandering)
{
isWandering = false;
StopCoroutine(NewHeading());
}