Example #1
0
        /// <summary>
        /// This routine handles movement for the player.
        /// </summary>
        /// <returns></returns>
        private bool InteractWithMovement()
        {
            // RaycastHit rayHit;
            ////Holds whether or not the raycast hit something.
            //bool hasHit = Physics.Raycast(GetMouseRay(), out rayHit);

            Vector3 moveLocation;
            bool    hasHit = RaycastNavMesh(out moveLocation);

            //Check if mouse is pointing to a movable position
            if (hasHit)
            {
                //Check to see if we can move to target
                if (!m_Mover.CanMoveTo(moveLocation))
                {
                    return(false);
                }

                if (Input.GetMouseButton(1))
                {
                    //Move to destination
                    m_Mover.StartMoveAction(moveLocation);
                }
                SetCursor(CursorType.Movement);
                return(true);
            }
            return(false);
        }