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
86bb2878
Commit
86bb2878
authored
Jan 05, 2018
by
Juliper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
not fix yet
parent
dc75a488
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
69 deletions
+65
-69
Level 2.unity
Assets/Scenes/Level 2.unity
+0
-0
BackgroundChanger.cs
Assets/Scripts/BackgroundChanger.cs
+61
-66
TagManager.asset
ProjectSettings/TagManager.asset
+1
-0
colourful-love.userprefs
colourful-love.userprefs
+3
-3
No files found.
Assets/Scenes/Level 2.unity
View file @
86bb2878
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Assets/Scripts/BackgroundChanger.cs
View file @
86bb2878
...
@@ -4,76 +4,71 @@ using UnityEngine;
...
@@ -4,76 +4,71 @@ using UnityEngine;
public
class
BackgroundChanger
:
MonoBehaviour
{
public
class
BackgroundChanger
:
MonoBehaviour
{
private
List
<
GameObject
>
backgroundGroup
=
new
List
<
GameObject
>();
private
List
<
GameObject
>
backgroundGroup
=
new
List
<
GameObject
>();
private
List
<
GameObject
>
obstacleGroup
=
new
List
<
GameObject
>();
private
List
<
GameObject
>
obstacleGroup
=
new
List
<
GameObject
>();
private
GameObject
[]
gameObjectGroup
;
private
GameObject
[]
gameObjectGroup
;
private
GameObject
background
;
private
GameObject
background
;
private
GameObject
obstacle
;
private
string
[]
colors
=
{
"Blue"
,
"Green"
};
private
string
[]
colors
=
{
"Blue"
,
"Green"
};
public
void
Start
()
{
CollectBackgrounds
();
CollectObstacles
();
UpdateBackgroud
(
colors
[
0
]);
}
private
void
CollectBackgrounds
()
public
void
Start
()
{
{
foreach
(
string
color
in
colors
)
CollectBackgrounds
();
{
CollectObstacles
();
background
=
GameObject
.
FindWithTag
(
color
+
"Background"
);
UpdateBackgroud
(
colors
[
0
]);
backgroundGroup
.
Add
(
background
);
}
}
}
private
void
CollectObstacles
()
private
void
CollectBackgrounds
()
{
{
foreach
(
string
color
in
colors
)
background
=
GameObject
.
FindWithTag
(
"Background"
);
{
}
obstacle
=
GameObject
.
FindWithTag
(
color
+
"Obstacle"
);
obstacleGroup
.
Add
(
obstacle
);
}
}
public
void
Update
()
private
void
CollectObstacles
()
{
{
if
(
Input
.
GetKey
(
KeyCode
.
X
))
foreach
(
string
color
in
colors
)
{
{
UpdateBackgroud
(
"Blue"
);
gameObjectGroup
=
GameObject
.
FindGameObjectsWithTag
(
color
+
"Obstacle"
);
}
else
if
(
Input
.
GetKey
(
KeyCode
.
Z
))
foreach
(
GameObject
obstacle
in
gameObjectGroup
)
{
{
UpdateBackgroud
(
"Green"
);
obstacleGroup
.
Add
(
obstacle
);
}
}
}
}
}
public
void
UpdateBackgroud
(
string
tagColor
)
public
void
Update
()
{
{
foreach
(
GameObject
background
in
backgroundGroup
)
if
(
Input
.
GetKey
(
KeyCode
.
X
))
{
{
if
(
background
.
tag
==
tagColor
+
"Background"
)
UpdateBackgroud
(
"Blue"
);
{
}
else
if
(
Input
.
GetKey
(
KeyCode
.
Z
))
background
.
SetActive
(
true
);
{
}
else
UpdateBackgroud
(
"Green"
);
{
}
background
.
SetActive
(
false
);
}
}
}
UpdateObstacle
(
tagColor
);
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
);
}
private
void
UpdateObstacle
(
string
tagColor
)
UpdateObstacle
(
tagColor
);
{
}
foreach
(
GameObject
obstacle
in
obstacleGroup
)
{
private
void
UpdateObstacle
(
string
tagColor
)
if
(
obstacle
.
tag
==
tagColor
+
"Obstacle"
)
{
{
foreach
(
GameObject
obstacle
in
obstacleGroup
)
obstacle
.
SetActive
(
false
);
{
}
else
if
(
obstacle
.
tag
==
tagColor
+
"Obstacle"
)
{
{
obstacle
.
SetActive
(
true
);
obstacle
.
SetActive
(
false
);
}
}
else
}
{
}
obstacle
.
SetActive
(
true
);
}
}
}
}
}
ProjectSettings/TagManager.asset
View file @
86bb2878
...
@@ -8,6 +8,7 @@ TagManager:
...
@@ -8,6 +8,7 @@ TagManager:
-
GreenBackground
-
GreenBackground
-
BlueObstacle
-
BlueObstacle
-
GreenObstacle
-
GreenObstacle
-
Background
layers
:
layers
:
-
Default
-
Default
-
TransparentFX
-
TransparentFX
...
...
colourful-love.userprefs
View file @
86bb2878
<Properties StartupItem="Assembly-CSharp.csproj">
<Properties StartupItem="Assembly-CSharp.csproj">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="Unity.Instance.Unity Editor" />
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="Unity.Instance.Unity Editor" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\Scripts\
PlayerControll
er.cs">
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\Scripts\
BackgroundChang
er.cs">
<Files>
<Files>
<File FileName="Assets\Scripts\BackgroundChanger.cs" Line="
32" Column="2
" />
<File FileName="Assets\Scripts\BackgroundChanger.cs" Line="
22" Column="1
" />
<File FileName="Assets\Scripts\PlayerController.cs" Line="1
4" Column="3
" />
<File FileName="Assets\Scripts\PlayerController.cs" Line="1
" Column="1
" />
<File FileName="Assets\Scripts\PhysicObject.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\PhysicObject.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\SceneLoader.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\SceneLoader.cs" Line="1" Column="1" />
</Files>
</Files>
...
...
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