public void InitiateHoist() { Vector2 targetPosition; try { targetPosition = level.GetTargetPositionHoist(this.transform.position); } catch (LevelException e) { targetPosition = (Vector2)this.transform.position + new Vector2(0, 3); } animator.SetTrigger("Hoist"); hoistLerp.StartLerping(rb.position, targetPosition, 0.9f); hoisting = true; }
public void InititateStep(float move, bool facingRight, bool run) { Direction direction = move < 0 ? Direction.Left : Direction.Right; Vector2 targetPosition = level.GetTargetPositionStep(this.transform, direction); float timeTaken = run ? RunConfig.timeTaken: WalkConfig.timeTaken; float animSpeed = run ? RunConfig.animSpeed : WalkConfig.animSpeed; lerp.StartLerping(rb.position, targetPosition, timeTaken); animator.SetFloat("Speed", animSpeed); running = run; stepping = true; if (move > 0 && !facingRight) { Flip(); } else if (move < 0 && facingRight) { Flip(); } }