protected virtual void Update() { ratStateMachine.Tick(); ClimbValid(); rotationUpdater.Update(Time.deltaTime); if (JumpBox != null) { JumpBox.Select(); } #if UNITY_EDITOR forwardDirection = ForwardDirection; ratState = ratStateMachine.CurrentState.ToString(); #endif }
private void CalculateClimbData() { jumpBox = rat.JumpBox; goal = jumpBox.GetJumpPoint(rat); direction = (goal - rat.transform.position).normalized; direction.y = 0; var towards = (goal - rat.transform.position); boxHeight = towards.y; towards.y = 0; magnitude = towards.magnitude; initialPoint = rat.transform.position; }
public bool ClimbValid() { var direction = LocalForward; RaycastHit info; bool success = Physics.Raycast(transform.position, direction, out info, 5f, 1 << LayerMask.NameToLayer("Interactable")); if (success) { JumpBox = info.transform.GetComponentInChildren <JumpBox>(); return(JumpBox != null); } if (JumpBox != null) { JumpBox.Select(false); } JumpBox = null; return(false); }