Esempio n. 1
0
 public void performRotateLeft()
 {
     rotating = ROTATION.LEFT;
     rState   = ROTATION_STATE.TRANSFORM;
     subState = SUB_STATE.SETUP;
 }
Esempio n. 2
0
 public void performRotateRight()
 {
     rotating = ROTATION.RIGHT;
     rState   = ROTATION_STATE.TRANSFORM;
     subState = SUB_STATE.SETUP;
 }
Esempio n. 3
0
    // State machine to handle rotation sequence
    //     This sequence has 4 steps:
    //         Transform: pauses the player and moves the platforms and modifiers back to their real position in 3D
    //         Rotate: rotates the camera to the next view
    //         Project: moves the platforms and modifiers back to a 2D position relative to the new view
    //         Done: resumes the player and resets the rotating variable
    //     Each step has 3 parts (excluding Done):
    //         Setup: initialize variables, calculate new positions/rotation, etc.
    //         Perform: perform the actual animation (translation, rotation, etc)
    //         Complete: finish up step, set enum value to next step, etc.
    void rotationController()
    {
        switch (rState)
        {
        case ROTATION_STATE.TRANSFORM:
            switch (subState)
            {
            case SUB_STATE.SETUP:
                pausePlayer();
                transformPlatformsAndModifiersBackTo3D();
                t        = 0.0f;
                subState = SUB_STATE.PERFORM;
                break;

            case SUB_STATE.PERFORM:
                if (interpolatePlatformsAndModifiers())
                {
                    subState = SUB_STATE.COMPLETE;
                }
                break;

            case SUB_STATE.COMPLETE:
                rState   = ROTATION_STATE.ROTATE;
                subState = SUB_STATE.SETUP;
                break;
            }
            break;

        case ROTATION_STATE.ROTATE:
            switch (subState)
            {
            case SUB_STATE.SETUP:
                t           = 0.0f;
                oldRotation = this.transform.eulerAngles.y;
                setNewRotation();
                subState = SUB_STATE.PERFORM;
                break;

            case SUB_STATE.PERFORM:
                if (interpolateCamera())
                {
                    subState = SUB_STATE.COMPLETE;
                }
                break;

            case SUB_STATE.COMPLETE:
                setNewView();
                rState   = ROTATION_STATE.PROJECT;
                subState = SUB_STATE.SETUP;
                break;
            }
            break;

        case ROTATION_STATE.PROJECT:
            switch (subState)
            {
            case SUB_STATE.SETUP:
                t = 0.0f;
                projectPlatformsAndModifiersOnto2D();
                subState = SUB_STATE.PERFORM;
                break;

            case SUB_STATE.PERFORM:
                if (interpolatePlatformsAndModifiers())
                {
                    subState = SUB_STATE.COMPLETE;
                }
                break;

            case SUB_STATE.COMPLETE:
                rState = ROTATION_STATE.DONE;
                break;
            }
            break;

        case ROTATION_STATE.DONE:
            resumePlayer();
            rotating = ROTATION.NONE;
            break;
        }
    }
Esempio n. 4
0
 public void performRotateRight()
 {
     rotating = ROTATION.RIGHT;
     rState = ROTATION_STATE.TRANSFORM;
     subState = SUB_STATE.SETUP;
 }
Esempio n. 5
0
 public void performRotateLeft()
 {
     rotating = ROTATION.LEFT;
     rState = ROTATION_STATE.TRANSFORM;
     subState = SUB_STATE.SETUP;
 }
Esempio n. 6
0
 // State machine to handle rotation sequence
 //     This sequence has 4 steps:
 //         Transform: pauses the player and moves the platforms and modifiers back to their real position in 3D
 //         Rotate: rotates the camera to the next view
 //         Project: moves the platforms and modifiers back to a 2D position relative to the new view
 //         Done: resumes the player and resets the rotating variable
 //     Each step has 3 parts (excluding Done):
 //         Setup: initialize variables, calculate new positions/rotation, etc.
 //         Perform: perform the actual animation (translation, rotation, etc)
 //         Complete: finish up step, set enum value to next step, etc.
 void rotationController()
 {
     switch(rState) {
         case ROTATION_STATE.TRANSFORM:
             switch(subState) {
                 case SUB_STATE.SETUP:
                     pausePlayer();
                     transformPlatformsAndModifiersBackTo3D();
                     t = 0.0f;
                     subState = SUB_STATE.PERFORM;
                     break;
                 case SUB_STATE.PERFORM:
                     if( interpolatePlatformsAndModifiers() ) {
                         subState = SUB_STATE.COMPLETE;
                     }
                     break;
                 case SUB_STATE.COMPLETE:
                     rState = ROTATION_STATE.ROTATE;
                     subState = SUB_STATE.SETUP;
                     break;
             }
             break;
         case ROTATION_STATE.ROTATE:
             switch(subState) {
                 case SUB_STATE.SETUP:
                     t = 0.0f;
                     oldRotation = this.transform.eulerAngles.y;
                     setNewRotation();
                     subState = SUB_STATE.PERFORM;
                     break;
                 case SUB_STATE.PERFORM:
                     if( interpolateCamera() ) {
                         subState = SUB_STATE.COMPLETE;
                     }
                     break;
                 case SUB_STATE.COMPLETE:
                     setNewView();
                     rState = ROTATION_STATE.PROJECT;
                     subState = SUB_STATE.SETUP;
                     break;
             }
             break;
         case ROTATION_STATE.PROJECT:
             switch(subState) {
                 case SUB_STATE.SETUP:
                     t = 0.0f;
                     projectPlatformsAndModifiersOnto2D();
                     subState = SUB_STATE.PERFORM;
                     break;
                 case SUB_STATE.PERFORM:
                     if( interpolatePlatformsAndModifiers() ) {
                         subState = SUB_STATE.COMPLETE;
                     }
                     break;
                 case SUB_STATE.COMPLETE:
                     rState = ROTATION_STATE.DONE;
                     break;
             }
             break;
         case ROTATION_STATE.DONE:
             resumePlayer();
             rotating = ROTATION.NONE;
             break;
     }
 }