Commit 25c38151 by Eko Simanjuntak

Merge branch 'level1' into 'development'

Level1 See merge request !1
parents 8ada040b 91203c6c
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -19,11 +19,7 @@ public class BackgroundChanger : MonoBehaviour { ...@@ -19,11 +19,7 @@ public class BackgroundChanger : MonoBehaviour {
private void CollectBackgrounds() private void CollectBackgrounds()
{ {
foreach(string color in colors) background = GameObject.FindWithTag("Background");
{
background = GameObject.FindWithTag(color + "Background");
backgroundGroup.Add(background);
}
} }
private void CollectObstacles() private void CollectObstacles()
...@@ -51,15 +47,12 @@ public class BackgroundChanger : MonoBehaviour { ...@@ -51,15 +47,12 @@ public class BackgroundChanger : MonoBehaviour {
public void UpdateBackgroud(string tagColor) public void UpdateBackgroud(string tagColor)
{ {
foreach(GameObject background in backgroundGroup) if(tagColor == "Green")
{ {
if (background.tag == tagColor + "Background") background.GetComponent<SpriteRenderer>().color = new Color32(46, 204, 113, 255);
{ } else if (tagColor == "Blue")
background.SetActive(true); {
} else background.GetComponent<SpriteRenderer>().color = new Color32(65, 131, 215, 255);
{
background.SetActive(false);
}
} }
UpdateObstacle(tagColor); UpdateObstacle(tagColor);
...@@ -69,7 +62,7 @@ public class BackgroundChanger : MonoBehaviour { ...@@ -69,7 +62,7 @@ public class BackgroundChanger : MonoBehaviour {
{ {
foreach (GameObject obstacle in obstacleGroup) foreach (GameObject obstacle in obstacleGroup)
{ {
if(obstacle.tag == tagColor + "Obstacle") if (obstacle.tag == tagColor + "Obstacle")
{ {
obstacle.SetActive(false); obstacle.SetActive(false);
} else } else
......
...@@ -28,7 +28,6 @@ public class PhysicsObject : MonoBehaviour ...@@ -28,7 +28,6 @@ public class PhysicsObject : MonoBehaviour
{ {
targetVelocity = Vector2.zero; targetVelocity = Vector2.zero;
ComputeVelocity(); ComputeVelocity();
Shoot();
} }
protected virtual void ComputeVelocity() protected virtual void ComputeVelocity()
...@@ -36,11 +35,6 @@ public class PhysicsObject : MonoBehaviour ...@@ -36,11 +35,6 @@ public class PhysicsObject : MonoBehaviour
} }
protected virtual void Shoot()
{
}
private void FixedUpdate() private void FixedUpdate()
{ {
Vector2 move; Vector2 move;
......
...@@ -41,4 +41,12 @@ public class PlayerController : PhysicsObject ...@@ -41,4 +41,12 @@ public class PlayerController : PhysicsObject
targetVelocity = move * maxSpeed; targetVelocity = move * maxSpeed;
} }
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Finish"))
{
SceneLoader.LoadLevelScene();
}
}
} }
...@@ -10,6 +10,11 @@ public class SceneLoader : MonoBehaviour { ...@@ -10,6 +10,11 @@ public class SceneLoader : MonoBehaviour {
SceneManager.LoadScene(sceneName); SceneManager.LoadScene(sceneName);
} }
public static void LoadLevelScene()
{
SceneManager.LoadScene("Level Selection");
}
public void QuitGame() public void QuitGame()
{ {
Application.Quit(); Application.Quit();
......
...@@ -35,6 +35,7 @@ GraphicsSettings: ...@@ -35,6 +35,7 @@ GraphicsSettings:
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: [] m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0} type: 0}
......
...@@ -4,10 +4,9 @@ ...@@ -4,10 +4,9 @@
TagManager: TagManager:
serializedVersion: 2 serializedVersion: 2
tags: tags:
- BlueBackground
- GreenBackground
- BlueObstacle - BlueObstacle
- GreenObstacle - GreenObstacle
- Background
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