public void StrafeCycle(BehaviourAI ai, SenseMemoryFactory.SMData data) { // get target ai.playerTarget = data.targets[0]; // get destination Vector3 moveTarget = ai.transform.position + Random.insideUnitSphere * strafeLength; // choose closer strafe target each time while (Vector3.Distance(moveTarget, data.targets[0].position) > Vector3.Distance(ai.transform.position, data.targets[0].position)) { moveTarget = ai.transform.position + Random.insideUnitSphere * strafeLength; Debug.Log("strafeMoveTargetChanged"); } // set destination.y moveTarget.y = moveHeight; // start height lerp method ai.HoverHeight(moveTarget.y); //Debug.Log("Strafing"); //GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); //sphere.transform.position = moveTarget; //sphere.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); ai.agent.SetDestination(moveTarget); // shoot ai.ShootAt(data.targets[0]); }
public override void KillPattern(BehaviourAI ai) { base.KillPattern(ai); ai.HoverHeight(startHeight); }