Пример #1
0
    /// <summary>
    /// Gets called from the decision master with the command to
    /// Move the player either forward or turn the player 90 degree left or right; Then
    /// set the internal state of the class to move appropriately which will be carried out
    /// by the Update function.
    /// </summary>
    /// <param name="direction">
    /// 0 is for direction forward
    /// 1 is for direction turn left
    /// 2 is for direction turn right
    /// </param>
    public void Move(int direction)
    {
        if (direction == 0)
        {
            if (!IsPossibleToMoveForward())
            {
                Destroy(m_progressbarCloned);
                m_moveForward.Start();
                m_endMotionDetector = new EndMotionDetector();
            }
        }

        if (direction == 1)
        {
            Destroy(m_progressbarCloned);
            m_direction.TurnLeft();
            m_endMotionDetector = new EndMotionDetector();
        }

        if (direction == 2)
        {
            Destroy(m_progressbarCloned);
            m_direction.TurnRight();
            m_endMotionDetector = new EndMotionDetector();
        }
    }
Пример #2
0
    /// <summary>
    /// Gets called from the decision master with the command to
    /// Move the player either forward or turn the player 90 degree left or right; Then
    /// set the internal state of the class to move appropriately which will be carried out
    /// by the Update function.
    /// </summary>
    /// <param name="direction">
    /// 0 is for direction forward
    /// 1 is for direction turn left
    /// 2 is for direction turn right
    /// </param>
    public void Move(int direction)
    {
        if (direction == 0)
        {
            if (!IsThereAWallAhead())
            {
                m_moveForward.Start();
                m_endMotionDetector = new EndMotionDetector();
            }
        }

        if (direction == 1)
        {
            m_direction.TurnLeft();
            m_endMotionDetector = new EndMotionDetector();
        }

        if (direction == 2)
        {
            m_direction.TurnRight();
            m_endMotionDetector = new EndMotionDetector();
        }
    }