Commit 217cddd9 by Eko Simanjuntak

Merge branch 'development' into 'level5'

# Conflicts: # Assets/Scripts/BackgroundChanger.cs
parents 4bb92381 89f9ea01
......@@ -53,6 +53,7 @@
<ItemGroup>
<Compile Include="Assets\Scripts\BackgroundChanger.cs" />
<Compile Include="Assets\Scripts\CameraController.cs" />
<Compile Include="Assets\Scripts\Move.cs" />
<Compile Include="Assets\Scripts\PhysicObject.cs" />
<Compile Include="Assets\Scripts\PlayerController.cs" />
<Compile Include="Assets\Scripts\SceneLoader.cs" />
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -22,19 +22,18 @@ public class BackgroundChanger : MonoBehaviour {
{
background = GameObject.FindWithTag("Background");
}
private void CollectObstacles()
{
foreach(string color in colors)
{
gameObjectGroup = GameObject.FindGameObjectsWithTag(color + "Obstacle");
foreach(GameObject obstacle in gameObjectGroup)
{
obstacleGroup.Add(obstacle);
}
}
}
private void CollectObstacles()
{
foreach(string color in colors)
{
gameObjectGroup = GameObject.FindGameObjectsWithTag(color + "Obstacle");
foreach(GameObject obstacle in gameObjectGroup)
{
obstacleGroup.Add(obstacle);
}
}
}
public void Update()
{
......@@ -73,7 +72,6 @@ public class BackgroundChanger : MonoBehaviour {
UpdateObstacle(tagColor);
}
private void UpdateObstacle(string tagColor)
{
foreach (GameObject obstacle in obstacleGroup)
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour {
public float speed = 10f;
public bool finish = false;
public string kindOfMove;
public float max;
public float min;
[SerializeField]
private Transform childTransform;
void Update () {
if (kindOfMove == "Horizontal") {
GerakHorizontal ();
} else {
GerakVertical ();
}
}
public virtual void GerakHorizontal(){
Vector2 posisiSementara = posisi;
if (finish) {
posisiSementara.x += speed * Time.deltaTime;
if (posisiSementara.x > max) {
finish = false;
}
}else{
posisiSementara.x -= speed * Time.deltaTime;
if (posisiSementara.x < min) {
finish = true;
}
}
posisi = posisiSementara;
childTransform = transform;
}
public virtual void GerakVertical(){
Vector2 posisiSementara = posisi;
if (finish) {
posisiSementara.y += speed * Time.deltaTime;
if (posisiSementara.y > max) {
finish = false;
}
}else{
posisiSementara.y -= speed * Time.deltaTime;
if (posisiSementara.y < min) {
finish = true;
}
}
posisi = posisiSementara;
childTransform = transform;
}
public Vector2 posisi{
get{
return(this.transform.position);
}
set{
this.transform.position = value;
}
}
private void OnTriggerEnter2D(Collider2D collision){
if (collision.gameObject.tag == "Player") {
collision.transform.SetParent (childTransform);
}
}
private void OnTriggerExit2D(Collider2D collision){
collision.transform.SetParent (null);
}
}
fileFormatVersion: 2
guid: 0254838888fbcec4db78101410c4992d
timeCreated: 1515311159
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -8,11 +8,18 @@ public class PlayerController : PhysicsObject
public float maxSpeed = 7;
public float jumpTakeOffSpeed = 7;
private SpriteRenderer spriteRenderer;
private Rigidbody2D myRigidBody;
private Vector2 startPost;
public GameObject player;
private void Awake()
{
spriteRenderer = GetComponent<SpriteRenderer>();
}
private void Start(){
startPost = transform.position;
myRigidBody = GetComponent<Rigidbody2D> ();
}
protected override void ComputeVelocity()
{
......@@ -44,9 +51,13 @@ public class PlayerController : PhysicsObject
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Finish"))
{
SceneLoader.LoadLevelScene();
}
if (collision.gameObject.CompareTag ("Finish")) {
SceneLoader.LoadLevelScene ();
} else if (collision.gameObject.CompareTag ("Water")) {
myRigidBody.velocity = Vector2.zero;
transform.position = startPost;
}
}
}
fileFormatVersion: 2
guid: a16566a6ce6ba9a44876de4d28e11422
guid: 8231a5c0f9e799746aeacb3329b93e90
timeCreated: 1512582417
licenseType: Free
NativeFormatImporter:
......
fileFormatVersion: 2
guid: 1c2f3df13d9276d48bde164b00bd9c60
guid: 73253ffc7981b53479551cf2c27a90c4
timeCreated: 1513047512
licenseType: Free
TextureImporter:
......
<Properties StartupItem="Assembly-CSharp.csproj">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="Unity.Instance.Unity Editor" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\Scripts\BackgroundChanger.cs">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\Scripts\PlayerController.cs">
<Files>
<<<<<<< HEAD
<File FileName="Assets\Scripts\PlayerController.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\BackgroundChanger.cs" Line="75" Column="1" />
<File FileName="Assets\Scripts\Move.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\BackgroundChanger.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\PlayerController.cs" Line="51" Column="4" />
<File FileName="Assets\Scripts\CameraController.cs" Line="1" Column="1" />
=======
<File FileName="Assets\Scripts\BackgroundChanger.cs" Line="7" Column="1" />
<File FileName="Assets\Scripts\PlayerController.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" />
>>>>>>> ac23c5fc430bf657611f48c48fbc4df34d477e5d
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
......
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