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;
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()
{
CollectBackgrounds();
CollectObstacles();
UpdateBackgroud(colors[0]);
}
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]);
}
private void CollectBackgrounds()
{
......@@ -35,29 +36,37 @@ public class BackgroundChanger : MonoBehaviour {
}
}
public void Update()
{
if (Input.GetKey(KeyCode.X))
{
UpdateBackgroud("Blue");
} else if (Input.GetKey(KeyCode.Z))
{
UpdateBackgroud("Green");
}
}
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);
}
UpdateObstacle(tagColor);
}
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);
}
UpdateObstacle(tagColor);
}
private void UpdateObstacle(string tagColor)
{
......
......@@ -3,13 +3,7 @@
--- !u!78 &1
TagManager:
serializedVersion: 2
tags:
- BlueObstacle
- GreenObstacle
- Background
- BlueBackground
- GreenBackground
- WhiteObstacle
tags: []
layers:
- Default
- 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