]> git.lizzy.rs Git - SuperMouseAdventure.git/commitdiff
Checkpoints 4.0
authorKG0104 <76601263+KG0104@users.noreply.github.com>
Wed, 31 Mar 2021 14:27:47 +0000 (16:27 +0200)
committerKG0104 <76601263+KG0104@users.noreply.github.com>
Wed, 31 Mar 2021 14:27:47 +0000 (16:27 +0200)
Es wird immer besser, allerdings funktioniert der letzte Checkpoint noch nicht.

2DGame/Assets/Scenes/SampleScene.unity
2DGame/Assets/Scripts/Maus/Checkpoint.cs

index 52c2840190c0b5e656acfe3bfbe680c547b7b74f..ac8fc14dca6c1a450016ebae2bbe2edd2c463c63 100644 (file)
@@ -3149,7 +3149,7 @@ BoxCollider2D:
   m_IsTrigger: 1
   m_UsedByEffector: 0
   m_UsedByComposite: 0
-  m_Offset: {x: 7.1443787, y: 0}
+  m_Offset: {x: 30.039719, y: 0}
   m_SpriteTilingProperty:
     border: {x: 0, y: 0, z: 0, w: 0}
     pivot: {x: 0, y: 0}
@@ -3160,7 +3160,7 @@ BoxCollider2D:
     adaptiveTiling: 0
   m_AutoTiling: 0
   serializedVersion: 2
-  m_Size: {x: 252.6164, y: 1}
+  m_Size: {x: 298.40707, y: 1}
   m_EdgeRadius: 0
 --- !u!4 &1527386856
 Transform:
index 1705cf26bad18d59a8ecd79e434587e5805e2450..ad6c532a765b5e6f5197ec5ccb13525bd3486bca 100644 (file)
@@ -18,6 +18,7 @@ public class Checkpoint : MonoBehaviour
     {
         abyss = GetComponent<Abyss>();
         health = GetComponent<Health>();
+        print(CheckPoints.Length);
     }
 
     // Update is called once per frame
@@ -35,9 +36,14 @@ public class Checkpoint : MonoBehaviour
                 if (CheckPoints[i].transform.position.x <= Mouse.transform.position.x && CheckPoints[i + 1].transform.position.x >= Mouse.transform.position.x)
                 {
                     Mouse.transform.position = CheckPoints[i].transform.position;
-                } else
+                } 
+                else if (CheckPoints[0].transform.position.x >= Mouse.transform.position.x)
                 {
-                    Mouse.transform.position = CheckPoints[CheckPoints.Length - 1].transform.position;
+                    Mouse.transform.position = CheckPoints[0].transform.position;
+                }
+                else if(CheckPoints[CheckPoints.Length-1].transform.position.x <= Mouse.transform.position.x)
+                {
+                    Mouse.transform.position = CheckPoints[CheckPoints.Length-1].transform.position;
                 }
 
                 if (Mouse.transform.position == CheckPoints[i].transform.position)