示例#1
0
 internal void SetAim(Vector2 dir, bool useArrow = true)
 {
     aimDirection = dir.normalized;
     if (useArrow)
     {
         hookGameObject.SetActive(true);
         hookGameObject.transform.rotation = MathP.RotationFromDirection(-aimDirection);
         if (aimDirection.x < 0)
         {
             hookHeadRenderer.flipY          = true;
             hookPos.transform.localPosition = new Vector2(hitPosX, -hitPosY);
         }
         else if (aimDirection.x > 0)
         {
             hookHeadRenderer.flipY          = false;
             hookPos.transform.localPosition = new Vector2(hitPosX, hitPosY);
         }
     }
     else
     {
         hookGameObject.SetActive(false);
     }
     if (playerController.isGrounded)
     {
         aimDirection = new Vector2(aimDirection.x, Mathf.Clamp(aimDirection.y, 0, 2));
     }
     if (!lockBackthrowTarget)
     {
         backthrowTarget.localPosition = -aimDirection * hookDistance;
     }
 }
示例#2
0
 internal void Update()
 {
     currentPos = transform.position;
     dir1       = currentPos - prevPos;
     dir1      *= 10;
     prevPos    = currentPos;
     if (rotateToDirection)
     {
         if (enemyAI.rotateDuringAttack && !enemyAI.doneAttacking)
         {
             transform.rotation = Quaternion.Slerp(transform.rotation, MathP.RotationFromDirection(-dir1), Time.deltaTime * 5f);
         }
         else
         {
             transform.right = rb.velocity;
         }
     }
     else
     {
         transform.rotation = Quaternion.identity;
         RotateGFX(input);
     }
 }