Genesis-3d Open source game engine Full Instance tutorial Cool game 03: Pause the game

Source: Internet
Author: User

3. Suspend the game

Pause Game Overview:

When the game is in progress, the player may encounter a variety of unexpected events. In the cool game of sudden situation of the impact of the game more, the game is played when the player died, the game can only start from scratch, so if the external factors affecting the game, it is obviously unreasonable. Developers change according to this demand, no game added pause function. Next we'll learn how to implement the Pause function in genesis-3d.

Principle:

As shown in Figure 3-1.

Figure 3-1

Implementation method:

Step 1:

Passive pause. When the game is carried out, encounter low electricity warning, telephone, SMS and other unpredictable factors, such as mobile phone equipment switching applications. The developer needs to ScriptRoot.cs the script file, add the stopped () function, and define its own function-related functions by invoking the stopped () function.

1 public override void Stopped ()

2 {

3//pause ();

4//save ();

5}

Step 2:

Game active paused. Players in the game, due to their own reasons need to suspend the game. If the developer's thinking is not clear, then the factors to consider are more complex. It is recommended that developers in the top-level ScriptRoot.cs script file to manage the logic of the entire game, so it is more convenient to achieve the entire game suspend function, can refer to the ScriptRoot.cs file in the logical relationship.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/

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.