コード例 #1
0
    // 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;
    }
コード例 #2
0
 public override void EnterAction()
 {
     base.EnterAction();
     if (!update)
     {
         if (monopoliseRotation)
         {
             movement.ApplyInfluenceRotation(-movement.GetInfluenceRotation());
         }
         movement.SetRotationPoint(aim.GetLocation());
     }
 }