Game opening lens closer scene fade effect production

Source: Internet
Author: User

Start the game the initial opening will have a mask layer gradient disappear, and then the lens zooms to the target scene. Lens closer to the main with Vector3.movetowards ()

1. Create a new project, in the hierarchy view, create the Guitexture item, named: Whitescreen, assign a white picture in texture "1024X512. PNG ", the specific parameters are set as follows:

2. Add a Emptyobject (empty object) named: Targetpancamera (the camera pans to the target) where you want the camera to be placed at the end.

3. Create a new empty object named: Controlscene (Control Scene), the parameters are set as follows:

4. Use the main Camera as a sub-object of Controlscene, set the following parameters:

5. New Script ControlTirleScene.cs (control title scene) "also includes a show hidden button

ControlTirleScene.cs Code:

1 /// <summary>2 ///controlling the title scene3 ///This is used for animating scripts that control the title scene (for example, Show/hide buttons, camera animations)4 /// </summary>5 /// 6 usingUnityengine;7 usingSystem. Collections;8 9  Public classControltirlescene:monobehaviourTen { One      PublicTransform TargetPoint;//The point where the camera moves to the machine. A     //Buttons and GUI -      PublicGameobject Titletext,buttonnew,buttonload,whitescreen; -  the     //Private Variables -     Private intTitlepattern =0;//Title Mode -     Private floatAlpha =0.5f;//Transparency -  +     voidStart () -     { +         //Set the default variable AAlpha =0.5f; atWhitescreen. SetActive (true ); -     } -  -     voidUpdate () -     { -         //camera panning to the specified position inTransform. Position = Vector3. Movetowards (transform position, targetpoint. Position,3*Time . deltatime); -  to         if(titlepattern==0 ) +         { -             //slowly reduce the transparency of the white mask layer the             if(Alpha >0 ) *             { $Alpha-= time. Deltatime *0.2f;Panax NotoginsengWhitescreen. Guitexture. color =NewColor (. 5f,. 5f,. 5f, Alpha); -             } the  +             //when approaching the target point, the game title is displayed A             if(MATHF. Abs (transform position. z-targetpoint position. z) <=6.0f ) the             { +Titlepattern =1; -Alpha =0; $TitleText. SetActive (true ); $             } -         } -  the         if(Titlepattern = =1 ) -         {Wuyi             //gradually increase the transparency, display the title logo the             if(Alpha <0.5f ) -             { WuAlpha + = time. Deltatime *0.5f; -TitleText. Guitexture. color =NewColor (. 5f,. 5f,. 5f, Alpha); About             } $             Else -             { -Titlepattern =2; -             } A         } +  the         if(Titlepattern = =2 ) -         { $             //Display Press the start the             if(Input.anykey) the             { the                 //deal with the next thing theTitlepattern =3; -             } in         } the  the         if(Titlepattern = =3 ) About         { the             //Show button New game, load game theButtonnew. SetActive (true ); theButtonload. SetActive (true ); +         } -     } the}

Game opening lens closer scene fade effect production

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.