NBA Shooting Games Summary

Source: Internet
Author: User

2/3d Games:3 D

Auxiliary plugins: native

game Making difficulty factor: Beginner

Game Tutorial URL:http://www.raywenderlich.com/20333/beginning-unity-3d-for-ios-part-1

1, GUI Adaptive resolution

     Public Const floatKdesignwidth = 960f;//Game width when testing     Public Const floatKdesignheight = 640f;//Game Height when testing
Private Vector2 _scaleoffset = Vector2. One; Private float_scale =1.0f; voidStart () {_scaleoffset.x= Screen.width/Kdesignwidth; _scaleoffset.y= Screen.height/Kdesignheight; _scale=Mathf.max (_scaleoffset.x, _SCALEOFFSET.Y); } voidOngui () {if(_scale <1) {Gui.skin= Gamemenuguiskinforsmall;//Small Font } Else{Gui.skin= Gamemenuguiskinfornormal;//Normal Font } //draw a background mapGui. Drawtexture (NewRect (0,0, Screen.width, screen.height), Backgroundtex); //Draw Button if(GUI. Button (NewRect ( the* _scaleoffset.x,345* _scaleoffset.y, the* _scaleoffset.x, the*_scaleoffset.y), Resumebuttontex, Guistyle.none)}

2. Get the total playback time of the animation and when the current animation is played (Legacy animation system)

Current Animation total time:_animation[_currentanimation.name].length/_animation[_currentanimation.name].speed

After the animation finishes, execute the Onanimationfinished method:

Invoke ("onanimationfinished", _animation[_currentanimation.name].length/ _ Animation[_currentanimation.name].speed); Private void onanimationfinished () {     //some codes}

What time the current animation is played:

Normalizedtime (float): The current normalized time of the animation, and 1 is the end of the animation. 0.5 is the middle of the animation

_animation[_currentanimation.name].normalizedtime

3. Judging the operating platform

    // judgment Equipment Platform     Public BOOL IsMobile    {        get        {            return (Application.platform = = Runtimeplatform.iphoneplayer | | Application.platform = = runtimeplatform.android);}    }

4, judge the accessibility of the network

    // determine if the network is available     Public BOOL networkavailable    {        get        {            return application.internetreachability! =  networkreachability.notreachable;        }    }

Notreachable: Indicates that the device is not connected to the network

Reachableviacarrierdatanetwork: Indicates that the device is connected through the operator data

Reachablevialocalareanetwork: Indicates that the device is connected via WiFi or a wired network

5, determine the direction of equipment

Input.deviceOrientation == DeviceOrientation.FaceDown  表示屏幕朝下

Unknown: The orientation of the device cannot be determined.

Portrait: Device in portrait mode, device upright and home button at bottom.

Portraitupsidedown: The device is in portrait mode, but upside down, the device is upright and the home button is at the top.

Landscapeleft: The device is in landscape mode, the device is upright and the home button is on the right.

Landscaperight: The device is in landscape mode, the device is upright and the home button is on the left.

Faceup: The device remains parallel to the ground and the screen is facing up.

Facedown: The device remains parallel to the ground and the screen is facing down.

6. Get Touch status

Input.touchcount get the number of finger touch screens

                foreachin  input.touches)                {                    if (touch.phase = = Touchphase.began                    )                        {//some codes                     }                }

Begin: The finger has touched the screen.

Moved: The finger moves on the screen.

Stationary: finger touches the screen but does not move.

Ended: Move your finger away from the screen. This is the last state of a touch.

Canceled: The system cancels the tracking touch, as the user puts the screen on his face or occurs at the same time as more than five contacts. This is the last state of a touch.

The other detailed uses of the input class are as follows:

Horizontal (horizontal ) and vertical (Vertical ) are mapped to W, a, S, D keys, and arrow keys

Fire1, Fire2, Fire3 are mapped to Ctrl,option (ALT) and command keys respectively

Mouse X and Mouse y are mapped to mouse movement increments

Window Shake X, and window Shake Y are mapped to the movement of the Windows

7. Visualize and change the size of the collider

Selecting the object of the collider and then holding down shift will show the handle of the collider so that you can visually change the collider size with your mouse.

The collider shown in the scene panel is green, except formesh Collider , whose mesh shows the collision boundary.

8. Single case mode

 Public classgamecontroller:monobehaviour{Private StaticGamecontroller _instance =NULL;  Public StaticGamecontroller sharedinstance {Get        {            if(_instance = =NULL) {_instance= Gameobject.findobjectoftype (typeof(Gamecontroller)) asGamecontroller; }            return_instance; }    }    voidAwake () {_instance= This; }
PrivateGamecontroller ()
{

}
}
iOS Create singleton mode: Http://stackoverflow.com/questions/5720029/create-singleton-using-gcds-dispatch-once-in-objective-c

NBA Shooting Games Summary

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.