확인 완료한 버전: 2018.1
The Enemy Controller script is the base class for other more specific Enemy controller components. It contains the common properties for these specific components:
It handles matching the NavMesh Agent and Animator. It can also have an arbitrary force set to it (e.g. used by the chomper/spitter when thrown after being hit).
interpolateTurning: A flag which defines whether calling SetForward will immediately set the forward direction to the to the specified value, or gradually move towards the specified using a the speed specified by the navmeshAgent.angularSpeed field. If this flag is set to true, you need to call SetForward repeatedly across frames. Generally, this is done when you call SetForward manually through a Behaviour update.
applyAnimationRotation: When set to true, this applies animation root motion rotation.
Each behaviour (through SceneLinkedSMB usually) will switch between the Animator or the NavMesh Agent. By default, the NavMesh Agent has priority.
Navmesh Agent Priority
This is the default. Call SetFollowNavmeshAgent with true to reset priority to the NavMesh Agent.
In that mode, the navmesh agent will move the enemy, and the speed will be set to (animator.deltaPosition / Time.deltaTime).magnitude. This matches the speed of the NavMesh Agent to the speed of the animation.
This can be set by calling SetFollowNavmeshAgent with false. In this mode, the position will be set by the OnAnimatorMove function, based on the deltaPosition given by the animation.
For example, this is used by the Chomper attack animation instead of having to match the NavMesh path/direction to where and how far we want to attack.
Calling AddForce will give a force to the control to follow. With each FixedUpdate, Gravity is added to that force and the controller is moved by that amount. No friction is added to that, so the force will keep building. Its main purpose is to just push back the controller in a short burst.
Calling ClearForce will revert to the other modes.