diff options
author | Carson Katri <carson.katri@gmail.com> | 2021-06-12 00:30:21 -0400 |
---|---|---|
committer | Carson Katri <carson.katri@gmail.com> | 2021-06-12 00:30:21 -0400 |
commit | ff111d95db1878f9c35d99e7d4fa0b4d9a0de37c (patch) | |
tree | a7d55973657e37405eea64178f86556f585d5f30 /Assets/Scripts/Controllers/Player/PlayerSegment.cs | |
parent | ae62fd809cfc5545de37c6bee0ba759402bba3fe (diff) | |
download | gmtk-gamejam-ff111d95db1878f9c35d99e7d4fa0b4d9a0de37c.tar.gz gmtk-gamejam-ff111d95db1878f9c35d99e7d4fa0b4d9a0de37c.tar.zst gmtk-gamejam-ff111d95db1878f9c35d99e7d4fa0b4d9a0de37c.zip |
Restructure scripts, improve locomotion, and add movement indicators
Diffstat (limited to 'Assets/Scripts/Controllers/Player/PlayerSegment.cs')
-rw-r--r-- | Assets/Scripts/Controllers/Player/PlayerSegment.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Assets/Scripts/Controllers/Player/PlayerSegment.cs b/Assets/Scripts/Controllers/Player/PlayerSegment.cs new file mode 100644 index 0000000..6306201 --- /dev/null +++ b/Assets/Scripts/Controllers/Player/PlayerSegment.cs @@ -0,0 +1,28 @@ +using System; +using UnityEngine; + +namespace Controllers.Player +{ + [RequireComponent(typeof(Rigidbody2D))] + [RequireComponent(typeof(SpriteRenderer))] + public class PlayerSegment : MonoBehaviour + { + [SerializeField] public Control left; + [SerializeField] public Control right; + + [SerializeField] public Vector3 forceOrigin; + + public Rigidbody2D Rigidbody => _rigidbody != null ? _rigidbody : _rigidbody = GetComponent<Rigidbody2D>(); + private Rigidbody2D _rigidbody; + + public SpriteRenderer Sprite => _sprite != null ? _sprite : _sprite = GetComponent<SpriteRenderer>(); + private SpriteRenderer _sprite; + } + + [Serializable] + public struct Control + { + public KeyCode keyCode; + public GameObject icon; + } +} |