Commit 52ac555a by Eko Simanjuntak

Merge branch 'level3' into 'development'

Level3 See merge request !4
parents 12ea5d78 906c2426
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,18 +4,19 @@ using UnityEngine; ...@@ -4,18 +4,19 @@ using UnityEngine;
public class BackgroundChanger : MonoBehaviour { 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" };
public void Start() private List<GameObject> backgroundGroup = new List<GameObject>();
{ private List<GameObject> obstacleGroup = new List<GameObject>();
CollectBackgrounds(); private GameObject[] gameObjectGroup;
CollectObstacles(); private GameObject background;
UpdateBackgroud(colors[0]); private string[] colors = {"Blue", "Green", "Yellow" };
}
public void Start()
{
CollectBackgrounds();
CollectObstacles();
UpdateBackgroud(colors[0]);
}
private void CollectBackgrounds() private void CollectBackgrounds()
{ {
...@@ -35,29 +36,37 @@ public class BackgroundChanger : MonoBehaviour { ...@@ -35,29 +36,37 @@ public class BackgroundChanger : MonoBehaviour {
} }
} }
public void Update() public void Update()
{ {
if (Input.GetKey(KeyCode.X)) if (Input.GetKey(KeyCode.X))
{ {
UpdateBackgroud("Blue"); UpdateBackgroud("Blue");
} else if (Input.GetKey(KeyCode.Z)) } else if (Input.GetKey(KeyCode.Z))
{ {
UpdateBackgroud("Green"); UpdateBackgroud("Green");
} } else if (Input.GetKey(KeyCode.C))
} {
UpdateBackgroud("Yellow");
public void UpdateBackgroud(string tagColor) }
{ }
if(tagColor == "Green")
{ public void UpdateBackgroud(string tagColor)
background.GetComponent<SpriteRenderer>().color = new Color32(46, 204, 113, 255); {
} else if (tagColor == "Blue") if(tagColor == "Green")
{ {
background.GetComponent<SpriteRenderer>().color = new Color32(65, 131, 215, 255); background.GetComponent<SpriteRenderer>().color = new Color32(46, 204, 113, 255);
} } else if (tagColor == "Blue")
{
UpdateObstacle(tagColor); 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);
}
private void UpdateObstacle(string tagColor) private void UpdateObstacle(string tagColor)
{ {
......
...@@ -3,13 +3,7 @@ ...@@ -3,13 +3,7 @@
--- !u!78 &1 --- !u!78 &1
TagManager: TagManager:
serializedVersion: 2 serializedVersion: 2
tags: tags: []
- BlueObstacle
- GreenObstacle
- Background
- BlueBackground
- GreenBackground
- WhiteObstacle
layers: layers:
- Default - Default
- TransparentFX - TransparentFX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment