diff options
author | Marvin Borner | 2018-05-23 18:13:38 +0200 |
---|---|---|
committer | Marvin Borner | 2018-05-23 18:13:38 +0200 |
commit | 36893bdbc54c0923173907007624f8af95495e9a (patch) | |
tree | ae32d3e6b101d08f04d15d3f821353d27c0bf0b4 /Assets/RepeatingBackground.cs | |
parent | e847649f0efdeea03da1c473d477a4d55cc253d3 (diff) |
Diffstat (limited to 'Assets/RepeatingBackground.cs')
-rw-r--r-- | Assets/RepeatingBackground.cs | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/Assets/RepeatingBackground.cs b/Assets/RepeatingBackground.cs deleted file mode 100644 index 4722ec2..0000000 --- a/Assets/RepeatingBackground.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class RepeatingBackground : MonoBehaviour { - - private BoxCollider2D groundCollider; - private float groundHorizontalLength; - - // Use this for initialization - void Start () - { - groundCollider = GetComponent<BoxCollider2D>(); - groundHorizontalLength = groundCollider.size.x; - } - - // Update is called once per frame - void Update () { - if (transform.position.x < -groundHorizontalLength) - { - RepositionBackground(); - } - } - - private void RepositionBackground() - { - Vector2 groundOffset = new Vector2(groundHorizontalLength * 2f, 0); - transform.position = (Vector2)transform.position + groundOffset; - } -} |