Example #1
0
    }//MovementWithAxis

    /// <summary>   RotationWithMovement()
    ///     Rotation of the ship
    /// </summary>
    void RotationWithMovement()
    {
        //STATES MACHINE FOR ROTATION
        switch (m_stateRotate)
        {
        case STATEROTATE.ROTATE_UP:
            if (RotateAndUndo(-maxRot, 0.0f, 0.0f))
            {
                m_stateRotate = STATEROTATE.NONE;
            }
            break;

        case STATEROTATE.ROTATE_DOWN:
            if (RotateAndUndo(maxRot, 0.0f, 0.0f))
            {
                m_stateRotate = STATEROTATE.NONE;
            }
            break;

        case STATEROTATE.ROTATE_LEFT:
            if (RotateAndUndo(0.0f, 0.0f, maxRot))
            {
                m_stateRotate = STATEROTATE.NONE;
            }
            break;

        case STATEROTATE.ROTATE_RIGHT:
            if (RotateAndUndo(0.0f, 0.0f, -maxRot))
            {
                m_stateRotate = STATEROTATE.NONE;
            }
            break;
        }
    }//RotationWithMovement
Example #2
0
    //------------------------------------------------METHODS------------------------------------
    /// <summary>   StartPosition()
    ///     We get the distance between the reference of the leftPoint and rightPoint. Then we made
    ///     a 3 by 3 matrix.
    ///     We initialize the start position to de middle position of x and y axis.
    ///     And also we say the spaceship is not moving.
    /// </summary>
    void StartPosition()
    {
        m_distance = (leftPointCircle.position - rightPointCircle.position).magnitude;

        m_middleHPos = 0.0f;
        m_leftPos    = -m_distance / 3;
        m_rightPos   = m_distance / 3;

        m_middleVPos = 0.0f;
        m_downPos    = -m_distance / 3;
        m_upPos      = m_distance / 3;

        this.transform.position = new Vector3(m_middleHPos, m_middleVPos);

        //States inicialization
        m_stateH      = STATE_HORIZONTAL.MIDDLE;
        m_stateV      = STATE_VERTICAL.MIDDLE;
        m_stateMove   = STATEMOVE.NONE;
        m_stateRotate = STATEROTATE.NONE;
    }//StartPosition
Example #3
0
    //------------------------------------------------METHODS------------------------------------
    /// <summary>   StartPosition()
    ///     We get the distance between the reference of the leftPoint and rightPoint. Then we made
    ///     a 3 by 3 matrix.
    ///     We initialize the start position to de middle position of x and y axis.
    ///     And also we say the spaceship is not moving.
    /// </summary>
    void StartPosition()
    {
        m_distance = (leftPointCircle.position - rightPointCircle.position).magnitude;

        m_middleHPos = 0.0f;
        m_leftPos = - m_distance / 3;
        m_rightPos = m_distance / 3;

        m_middleVPos = 0.0f;
        m_downPos = -m_distance / 3;
        m_upPos = m_distance / 3;

        this.transform.position = new Vector3(m_middleHPos, m_middleVPos);

        //States inicialization
        m_stateH = STATE_HORIZONTAL.MIDDLE;
        m_stateV = STATE_VERTICAL.MIDDLE;
        m_stateMove = STATEMOVE.NONE;
        m_stateRotate = STATEROTATE.NONE;
    }
Example #4
0
    /// <summary>   RotationWithMovement()
    ///     Rotation of the ship
    /// </summary>
    void RotationWithMovement()
    {
        //STATES MACHINE FOR ROTATION
        switch(m_stateRotate)
        {
            case STATEROTATE.ROTATE_UP:
                if(RotateAndUndo(-maxRot, 0.0f, 0.0f))
                    m_stateRotate = STATEROTATE.NONE;
                break;

            case STATEROTATE.ROTATE_DOWN:
                if(RotateAndUndo(maxRot, 0.0f, 0.0f))
                    m_stateRotate = STATEROTATE.NONE;
                break;

            case STATEROTATE.ROTATE_LEFT:
                if(RotateAndUndo(0.0f, 0.0f, maxRot))
                    m_stateRotate = STATEROTATE.NONE;
                break;

            case STATEROTATE.ROTATE_RIGHT:
                if(RotateAndUndo(0.0f, 0.0f, -maxRot))
                    m_stateRotate = STATEROTATE.NONE;
                break;
        }
    }