Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ImBeCiliC committed Feb 12, 2017
2 parents e3b97e8 + 89fdf9d commit 68831d4
Show file tree
Hide file tree
Showing 28 changed files with 28,638 additions and 9,825 deletions.
2 changes: 1 addition & 1 deletion ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ EditorBuildSettings:
path: assets/Szenen/Szene01.unity
- enabled: 1
path: assets/Szenen/Szene02.unity
- enabled: 1
- enabled: 0
path: assets/Szenen/Szene03.unity
- enabled: 1
path: assets/Szenen/Szene04.unity
Expand Down
2 changes: 1 addition & 1 deletion ProjectSettings/TagManager.asset
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TagManager:
- UI
-
-
-
- Plattform
-
-
-
Expand Down
5 changes: 3 additions & 2 deletions assets/Szenen/Szene03.unity.meta → assets/New Folder.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 47 additions & 10 deletions assets/Skript/bewPlattform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,67 @@ public class bewPlattform : MonoBehaviour {
private Vector3 newPos;
public float speed;

private Vector3 nextPos;
public Transform childTransform;

public Transform transformB;
// Use this for initialization
void Start () {
startPos = transform.position;
startPos = childTransform.localPosition;
newPos = transformB.localPosition;
nextPos = newPos;
//startPos = transform.position;

//speed = Random.Range (5f, 10f);
}

// Update is called once per frame
void Update () {
newPos = startPos;
newPos.x = newPos.x + Mathf.PingPong (Time.time * speed, 6) - 3;
Move ();
//newPos.x = newPos.x + Mathf.PingPong (Time.time * speed, 6) - 3;

transform.position = newPos;
//transform.position = newPos;
}

void OnTriggerEnter2D (Collider2D other) {
if (other.gameObject.CompareTag ("Spieler") && other.transform.parent != gameObject.transform) {
other.transform.parent = gameObject.transform;
private void Move()
{
childTransform.localPosition = Vector3.MoveTowards (childTransform.localPosition, nextPos, speed * Time.deltaTime);
if(Vector3.Distance(childTransform.localPosition, nextPos) <= 0.1)
{
ChangeDestination();
}
}

private void ChangeDestination()
{
nextPos = nextPos != startPos ? startPos : newPos;
}

private void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Spieler") {
other.transform.parent = transform;
}

}

void OnTriggerExit2D (Collider2D other) {
//other.transform.parent = null;
transform.DetachChildren();
private void OnTriggerExit2D(Collider2D other)
{
if (other.tag == "Spieler") {
other.transform.parent = null;
}
}
//private void OnCollisionEnter2D(Collision2D other)
//{
//if (other.gameObject.CompareTag("Spieler") ){
//other.gameObject.layer = 8;
//other.transform.SetParent(childTransform);
//other.transform.parent = transform;
//}
//}

//private void OnCollisionExit2D(Collision2D other)
//{
// other.transform.SetParent (null);
//}
}
32 changes: 32 additions & 0 deletions assets/Skript/bewPlattform1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bewPlattform1 : MonoBehaviour {

private Vector3 startPos;
private Vector3 newPos;
public float speed;

//private Vector3 nextPos;
//public Transform childTransform;

//public Transform transformB;
// Use this for initialization
void Start () {
//startPos = childTransform.localPosition;
//newPos = transformB.localPosition;
//nextPos = newPos;
startPos = transform.position;

//speed = Random.Range (5f, 10f);
}

// Update is called once per frame
void Update () {

newPos.x = newPos.x + Mathf.PingPong (Time.time * speed, 6) - 3;

transform.position = newPos;
}
}
12 changes: 12 additions & 0 deletions assets/Skript/bewPlattform1.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions assets/Skript/coin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ public class coin : MonoBehaviour {

private int CoinCounter;
public Text scoreText;
public Text highscoreText;

// Use this for initialization
void Start () {
//CoinCounter = 0;
CoinCounter = PlayerPrefs.GetInt("Score");
highscoreText.text = "Highscore: " + PlayerPrefs.GetInt ("Highscore").ToString();

}
// Update is called once per frame
void Update () {
Expand All @@ -36,6 +39,12 @@ void OnTriggerEnter2D(Collider2D other)
scoreText.text = " " + CoinCounter.ToString();
Debug.Log ("Score: " + CoinCounter);

if (CoinCounter > PlayerPrefs.GetInt ("Highscore")) {
// Überschreibe Highscore
PlayerPrefs.SetInt("Highscore", CoinCounter);
highscoreText.text = "Highscore: " + PlayerPrefs.GetInt ("Highscore").ToString();
}

}
}
}
22 changes: 5 additions & 17 deletions assets/Skript/haltCharakter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,15 @@ public class haltCharakter : MonoBehaviour {



void OnTriggerExit2D(Collider2D other)
void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.tag == "platform"){
transform.parent = null;

}
}

void OnTriggerEnter2D(Collider2D other){

if(other.gameObject.tag == "platform"){
other.transform.parent = gameObject.transform;

}

}

void OnCollision2D(Collider2D other){

if(other.gameObject.tag == "platform"){
transform.position = other.transform.position;
}
void OnTriggerExit2D(Collider2D other)
{
other.transform.parent = null;
}

}
15 changes: 8 additions & 7 deletions assets/Skript/levelauswahl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ public class levelauswahl : MonoBehaviour {
// Use this for initialization
void Start () {
//Level 1 aktiv
PlayerPrefs.SetInt("Szene00", 3);
PlayerPrefs.SetInt ("Szene00", 1);

if (PlayerPrefs.GetInt (sceneToload.ToString ()) == 3) {

if (PlayerPrefs.GetInt (sceneToload.ToString ()) == 1) {
//Button aktivieren
this.GetComponent<Button>().interactable = true;
} else
{
this.GetComponent<Button> ().interactable = true;
} else {
//Button deaktivieren
this.GetComponent<Button>().interactable = false;
this.GetComponent<Button> ().interactable = false;

}

}

// Update is called once per frame
void Update () {

Expand Down
Loading

0 comments on commit 68831d4

Please sign in to comment.