Part 2: Deal Or No Deal

This part will continuously previous part of "Deal or No Deal" Game. Surely, You are able to complete this game, after you implement this part.

Step 4: Click to select Object

1.    Create Scripts files and its name as PickUp

2.    Using the Raycast to select your Object. It means that we will adjust the mouse’s location coordinates to coordinates of camera screen.

Row 3: invoke Function, left click.

Row 5 - 8: Define mouse Coordinates coincide with the coordinates of the object, we will print ("Click").

Note: the tag must be assigned game Object is present.

3. We drag this script onto Main Camera away.

4. After you click the object going through the display

Step 5: Initiate List Number

1.    1. We are using this list to fill with Numbers


      2. Create Script File and its name as ListNumber.  This Script is used to define ListNumber Class which we use to hold List Number.


3.    3. Continuously, Create Script File and its name as RamdomeNumber


Row 7: We will define Ist with style as List()

Rows 20-45: Add Numbers into list

4.    In the Hiearchy, Create Empty ->Rename it to GameCTL.  Drag and Drop this Script into GameCTL

Step 6:  After choosing Object and having List Number. You click  to select Object and list Number be disappeared

This idea is when you click to select Object, we will randomly create Numbers on List Number and import it to Screen, Then, delete Numbers on List

Row 3:  Count List Component.  When list has Components, we could continuously play it. It means that if all of components are deleted, game will be finished.

Row 7:  We will random 1 number from 1 to SizeOf. Remember that SizeOf will be changed. Example, initially, we have 26 Components. But, when you click to select 1 Component, SixeOf will decrease 1 Component. It means that we will have 25 Components

Rows 8-10: Using to save value of 2 initial Presents which we click to select

Row 14: Save value of Object which we click on text. This row will be used when we click into Object, Number will display on that Object.

Row 15: Find Object which has name as “lst[rd].number”. This name is similar with removed value.  And then, you adjust its color. It means that each click to select Object, Value will be created. Then, it finds Objects which hasn’t value (3D text which we create on scene) -> change value color.

Row 17: Calculate returning points after turns

Row 19: remove that number out of list

It is easy to do by basic Steps. Besides that you could create animation for each Object.


                                 Image15:  Completed game interface

Link package unity :

Play game to enjoy what you've done. Explore more awesome games.