Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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);
        }