// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Vector2 aim = new Vector2(animator.GetFloat(aimCode + "X"), animator.GetFloat(aimCode + "Y")); movementSpeed = animator.GetFloat(speedCode); movement = animator.GetComponentInParent <AiMovement>(); movement.SetRotationPoint(aim); directionOfMove = (aim - (Vector2)movement.transform.position).normalized * movementSpeed; }
public override void EnterAction() { base.EnterAction(); if (!update) { if (monopoliseRotation) { movement.ApplyInfluenceRotation(-movement.GetInfluenceRotation()); } movement.SetRotationPoint(aim.GetLocation()); } }