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 {
private void CollectBackgrounds()
{
foreach(string color in colors)
{
background = GameObject.FindWithTag(color + "Background");
backgroundGroup.Add(background);
}
background = GameObject.FindWithTag("Background");
}
private void CollectObstacles()
......@@ -51,15 +47,12 @@ public class BackgroundChanger : MonoBehaviour {
public void UpdateBackgroud(string tagColor)
{
foreach(GameObject background in backgroundGroup)
if(tagColor == "Green")
{
if (background.tag == tagColor + "Background")
{
background.SetActive(true);
} else
{
background.SetActive(false);
}
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);
......@@ -69,7 +62,7 @@ public class BackgroundChanger : MonoBehaviour {
{
foreach (GameObject obstacle in obstacleGroup)
{
if(obstacle.tag == tagColor + "Obstacle")
if (obstacle.tag == tagColor + "Obstacle")
{
obstacle.SetActive(false);
} else
......
......@@ -28,7 +28,6 @@ public class PhysicsObject : MonoBehaviour
{
targetVelocity = Vector2.zero;
ComputeVelocity();
Shoot();
}
protected virtual void ComputeVelocity()
......@@ -36,11 +35,6 @@ public class PhysicsObject : MonoBehaviour
}
protected virtual void Shoot()
{
}
private void FixedUpdate()
{
Vector2 move;
......
......@@ -41,4 +41,12 @@ public class PlayerController : PhysicsObject
targetVelocity = move * maxSpeed;
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Finish"))
{
SceneLoader.LoadLevelScene();
}
}
}
......@@ -10,6 +10,11 @@ public class SceneLoader : MonoBehaviour {
SceneManager.LoadScene(sceneName);
}
public static void LoadLevelScene()
{
SceneManager.LoadScene("Level Selection");
}
public void QuitGame()
{
Application.Quit();
......
......@@ -35,6 +35,7 @@ GraphicsSettings:
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
......
......@@ -4,10 +4,9 @@
TagManager:
serializedVersion: 2
tags:
- BlueBackground
- GreenBackground
- BlueObstacle
- GreenObstacle
- Background
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