Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
colourful-love
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eko Simanjuntak
colourful-love
Commits
408f312a
Commit
408f312a
authored
Jan 08, 2018
by
Juliper
Browse files
Options
Browse Files
Download
Plain Diff
fix-2
parents
5e5ec16c
52ac555a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
48 deletions
+36
-48
.suo
.vs/Colorful Love/v15/.suo
+0
-0
storage.ide
.vs/Colorful Love/v15/sqlite3/storage.ide
+0
-0
Level 3.unity
Assets/Scenes/Level 3.unity
+0
-0
BackgroundChanger.cs
Assets/Scripts/BackgroundChanger.cs
+35
-38
TagManager.asset
ProjectSettings/TagManager.asset
+1
-10
No files found.
.vs/Colorful Love/v15/.suo
View file @
408f312a
No preview for this file type
.vs/Colorful Love/v15/sqlite3/storage.ide
View file @
408f312a
No preview for this file type
Assets/Scenes/Level 3.unity
View file @
408f312a
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Assets/Scripts/BackgroundChanger.cs
View file @
408f312a
...
...
@@ -4,26 +4,24 @@ using UnityEngine;
public
class
BackgroundChanger
:
MonoBehaviour
{
private
List
<
GameObject
>
backgroundGroup
=
new
List
<
GameObject
>();
private
List
<
GameObject
>
obstacleGroup
=
new
List
<
GameObject
>();
private
GameObject
[]
gameObjectGroup
;
private
GameObject
background
;
private
string
[]
colors
=
{
"Blue"
,
"Green"
,
"Yellow"
};
public
void
Start
()
{
CollectBackgrounds
();
CollectObstacles
();
UpdateBackgroud
(
colors
[
0
]);
}
public
void
Start
()
{
CollectBackgrounds
();
CollectObstacles
();
UpdateBackgroud
(
colors
[
0
]);
}
private
void
CollectBackgrounds
()
{
background
=
GameObject
.
FindWithTag
(
"Background"
);
}
private
void
CollectObstacles
()
{
foreach
(
string
color
in
colors
)
...
...
@@ -35,38 +33,37 @@ public class BackgroundChanger : MonoBehaviour {
}
}
}
public
void
Update
()
{
if
(
Input
.
GetKey
(
KeyCode
.
X
))
{
UpdateBackgroud
(
"Blue"
);
}
else
if
(
Input
.
GetKey
(
KeyCode
.
Z
))
{
UpdateBackgroud
(
"Green"
);
}
else
if
(
Input
.
GetKey
(
KeyCode
.
C
))
{
UpdateBackgroud
(
"Yellow"
);
}
}
public
void
Update
()
{
if
(
Input
.
GetKey
(
KeyCode
.
X
))
{
UpdateBackgroud
(
"Blue"
);
}
else
if
(
Input
.
GetKey
(
KeyCode
.
Z
))
{
UpdateBackgroud
(
"Green"
);
}
else
if
(
Input
.
GetKey
(
KeyCode
.
C
))
{
UpdateBackgroud
(
"Yellow"
);
}
}
public
void
UpdateBackgroud
(
string
tagColor
)
{
if
(
tagColor
==
"Green"
)
{
background
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color32
(
46
,
204
,
113
,
255
);
}
else
if
(
tagColor
==
"Blue"
)
{
background
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color32
(
65
,
131
,
215
,
255
);
}
else
if
(
tagColor
==
"Yellow"
)
{
background
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color32
(
255
,
193
,
7
,
255
);
}
public
void
UpdateBackgroud
(
string
tagColor
)
{
if
(
tagColor
==
"Green"
)
{
background
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color32
(
46
,
204
,
113
,
255
);
}
else
if
(
tagColor
==
"Blue"
)
{
background
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color32
(
65
,
131
,
215
,
255
);
}
else
if
(
tagColor
==
"Yellow"
)
{
background
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color32
(
255
,
193
,
7
,
255
);
}
UpdateObstacle
(
tagColor
);
}
UpdateObstacle
(
tagColor
);
}
private
void
UpdateObstacle
(
string
tagColor
)
{
...
...
ProjectSettings/TagManager.asset
View file @
408f312a
...
...
@@ -3,16 +3,7 @@
---
!u!78
&1
TagManager
:
serializedVersion
:
2
tags
:
-
BlueObstacle
-
GreenObstacle
-
Background
-
BlueBackground
-
GreenBackground
-
WhiteObstacle
-
YellowObstacle
-
GreyObstacle
-
Water
tags
:
[]
layers
:
-
Default
-
TransparentFX
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment