Commit 25b0c501 authored by Mitchie Maluschnig's avatar Mitchie Maluschnig
Browse files

points added when player does a flip

parent 6336f2dc
......@@ -98,7 +98,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bbf42f3430dfc5b48a94215583091a1d, type: 3}
m_Name:
m_EditorClassIdentifier:
points: 10
points: 100
specialItem: {fileID: 1649884426353186}
OnCollectParticles: {fileID: 1301897093530838, guid: fe523caf0352a7547a3f1404bd46b43d,
type: 2}
......
......@@ -750,7 +750,7 @@ GameObject:
- component: {fileID: 1245897937}
- component: {fileID: 1245897936}
m_Layer: 5
m_Name: Canvas
m_Name: ScoreTracker
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......@@ -1532,6 +1532,7 @@ GameObject:
- component: {fileID: 2089978958}
- component: {fileID: 2089978957}
- component: {fileID: 2089978961}
- component: {fileID: 2089978963}
m_Layer: 0
m_Name: TrapezePerson
m_TagString: Player
......@@ -1678,3 +1679,14 @@ MonoBehaviour:
botPivot: {fileID: 859786666}
currentPivot: {fileID: 0}
onTrapeze: 0
--- !u!114 &2089978963
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2089978956}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 297674a11bfe68e42b79507cd3da50f8, type: 3}
m_Name:
m_EditorClassIdentifier:
......@@ -6,7 +6,7 @@ using UnityEngine;
//https://forum.unity.com/threads/counting-an-objects-rotations.4170/
public class CountRotations : MonoBehaviour {
private float totalRotation = 0;
public int nrOfRotations {
public int rotations {
get {
return ((int)totalRotation) / 360;
}
......
......@@ -23,6 +23,7 @@ public class TrapezePerson : MonoBehaviour {
private GameObject currentTrapeze;
private float linearVelocity;
private int prevFlip;
// Use this for initialization
......@@ -37,8 +38,7 @@ public class TrapezePerson : MonoBehaviour {
// Update is called once per frame
void Update () {
//checkRotations();
print(rotations.nrOfRotations);
checkFlip();
if (Input.GetKey(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) {
if (onTrapeze) {
body.AddTorque(swingForce / 10);
......@@ -77,6 +77,8 @@ public class TrapezePerson : MonoBehaviour {
if(trapeze.tag == "Pie") {
trapeze.GetComponent<SpecialTrapeze>().setCollected();
}
}
public void DetachFromTrapeze() {
......@@ -91,4 +93,19 @@ public class TrapezePerson : MonoBehaviour {
rotations.resetCounter();
}
void checkFlip() {
//check how many flips the player did
int flips = rotations.rotations;
if (flips != prevFlip && !onTrapeze) {
if(flips > 0) {
print("back flip");
} else {
print("front flip");
}
TrapezeController.score += 10 * Mathf.Abs(flips);
rotations.resetCounter();
prevFlip = rotations.rotations;
}
}
}
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