Unity3d_ (game) dessert 01_ production Props

Source: Internet
Author: User

Not finished!! Expected to be completed before August 29

Game Effect Show

Achieve results

Make a scene, game prefab

Shadow hidden Camera small icon

(Click Shadow Camera Small icon)

Create a new Sprite, add a doughnut picture

(The value of the modified scale is 0.45)

Set the donut as a preset

With doughnuts, making chocolate into a prefab

(Modify the value of scale to 0.65 and set the order in layer to a value of-1)

And make chocolate into a preset.

  

Create a game background

(The game background can be set slightly larger, anti-exposure)

Create a game manager

Create Gameobject objects, add Gamemanager scripts, mount to Gameobject

usingSystem.Collections;usingSystem.Collections.Generic;usingUnityengine; Public classGamemanager:monobehaviour {//Single Case    Private StaticGamemanager _instance;  Public StaticGamemanager Instance {Get        {            return_instance; }        Set{_instance=value; }    }    Private voidAwake () {_instance= This; }    //Use this for initialization    voidStart () {}//Update is called once per frame    voidUpdate () {}}
GameManager.cs

Create a single case

Private Static Gamemanager _instance;

   Public Static Gamemanager Instance    {        get        {            return  _instance;        }         Set         {            = value;        }    }

(using shortcut keys to generate a singleton method Ctrl+r+e)

Game initialization function

    Private void Awake ()    {        this;    }

Add a reference to the game manager, set the grid game to the row

     Public int Xcolumn;      Public int Yrow;

Add a chocolate reference

 Public Gameobject Gridprefab;

Creating chocolate in a game scene

void Start () {        for (int0; x < Xcolumn; + +)        {            for ( int y=0; y<yrow;y++)            {                = instantiate (Gridprefab,new Vector3 (x, Y,0), quaternion.identity                ); // chocolate rotates with transform parent object                 chocolate.transform.SetParent (transform);     }}}

Run the program

(Set the order in layer of the game background to-2)

Correcting background position

Unity3d_ (game) dessert 01_ production Props

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.