HassaMassa
Modder
Divine
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
Operating System
Android
Creating Spawn Point
The Spawn Point manages the spawning of Pin when the Player touches the screen. First create a GameObject rename it as Spawn Point. Create a C# script save it to Gameplay folder as Spawner.
Import this module first:
Write these blocks of code inside the Spawner class
Creating the Scoring
We will create now the Scoring, this will count all the Pins that are success pinned to the Target. To do this first create an UI Text, and then set each components as shown in the image.
Score UI
Score Text
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
Download
Android
Creating Spawn Point
The Spawn Point manages the spawning of Pin when the Player touches the screen. First create a GameObject rename it as Spawn Point. Create a C# script save it to Gameplay folder as Spawner.
Import this module first:
- using
UnityEngine.UI
;
Write these blocks of code inside the Spawner class
- public
GameObject pin;
- public
int
maxPin;
- [
HideInInspector]
- public
int
totalPin;
- [
HideInInspector]
- public
int
limitPin;
- private
Text countText;
- void
Awake(
)
{
- totalPin =
maxPin;
- }
- // Use this for initialization
- void
Start (
)
{
- InitializeSpawnVariables (
)
;
- }
- // Update is called once per frame
- void
Update (
)
{
- }
- void
InitializeSpawnVariables(
)
{
- limitPin =
4
;
- Vector3[
]
pinPosition =
new
[
]
{
- new
Vector3(
0
, -
2.
0f, 0
)
,
- new
Vector3(
0
, -
2.
8f, 0
)
,
- new
Vector3(
0
, -
3.
6f, 0
)
,
- new
Vector3(
0
, -
4.
4f, 0
)
- }
;
- for
(
int
i =
0
;
i <
limitPin;
i++
)
{
- if
(
maxPin !=
0
)
{
- GameObject newPin =
Instantiate (
pin, pinPosition [
i]
, Quaternion.
identity
)
as
GameObject;
- if
(
i ==
0
)
- newPin.
transform
.
GetComponent
<
Pin>
(
)
.
isPrepareToShoot
=
true
;
- countText =
newPin.
transform
.
GetChild
(
1
)
.
gameObject
.
transform
.
GetChild
(
0
)
.
gameObject
.
GetComponent
<
Text>
(
)
;
- countText.
text
=
maxPin.
ToString
(
)
;
- maxPin--;
- }
- }
- }
- public
void
IsPrepareToFire(
)
{
- int
index =
0
;
- Vector3[
]
pinPosition =
new
[
]
{
- new
Vector3 (
0
, -
2.
0f, 0
)
,
- new
Vector3 (
0
, -
2.
8f, 0
)
,
- new
Vector3 (
0
, -
3.
6f, 0
)
- }
;
- GameObject[
]
nextPin =
GameObject.
FindGameObjectsWithTag
(
"Pin"
)
;
- foreach
(
GameObject newPin in
nextPin)
{
- if
(
!
newPin.
transform
.
GetComponent
<
Pin>
(
)
.
hasMove
)
{
- newPin.
transform
.
position
=
Vector3.
Lerp
(
newPin.
transform
.
position
, pinPosition [
index]
, Time.
time
)
;
- if
(
index ==
0
)
{
- newPin.
transform
.
GetComponent
<
Pin>
(
)
.
isPrepareToShoot
=
true
;
- }
- index++;
- }
- }
- if
(
maxPin !=
0
)
{
- GameObject newPin =
Instantiate (
pin, new
Vector3(
0
, -
4.
4f, 0
)
, Quaternion.
identity
)
as
GameObject;
- countText =
newPin.
transform
.
GetChild
(
1
)
.
gameObject
.
transform
.
GetChild
(
0
)
.
gameObject
.
GetComponent
<
Text>
(
)
;
- countText.
text
=
maxPin.
ToString
(
)
;
- maxPin--;
- }
- }
Creating the Scoring
We will create now the Scoring, this will count all the Pins that are success pinned to the Target. To do this first create an UI Text, and then set each components as shown in the image.
Score UI

Score Text

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
Download
You must upgrade your account or reply in the thread to view hidden text.