diff --git a/.idea/.idea.unity c# workshop/.idea/contentModel.xml b/.idea/.idea.unity c# workshop/.idea/contentModel.xml index e43057a..182d125 100644 --- a/.idea/.idea.unity c# workshop/.idea/contentModel.xml +++ b/.idea/.idea.unity c# workshop/.idea/contentModel.xml @@ -6,12 +6,14 @@ - - - - - - + + + + + + + + diff --git a/.idea/.idea.unity c# workshop/.idea/workspace.xml b/.idea/.idea.unity c# workshop/.idea/workspace.xml index b23852f..f37434b 100644 --- a/.idea/.idea.unity c# workshop/.idea/workspace.xml +++ b/.idea/.idea.unity c# workshop/.idea/workspace.xml @@ -1,7 +1,12 @@ - + + + + + + - - - - + + + @@ -75,7 +81,7 @@ - + @@ -84,6 +90,17 @@ + + + diff --git a/Assets/Init/Scripts/Gem.cs b/Assets/Init/Scripts/Gem.cs index 4c8e61d..c01b91d 100644 --- a/Assets/Init/Scripts/Gem.cs +++ b/Assets/Init/Scripts/Gem.cs @@ -6,16 +6,17 @@ namespace EGaDSTutorial { public interface IGem { + float Value { get; } void OnPickup(); - } [RequireComponent(typeof(Collider2D))] - [AddComponentMenu("Gem/Gem")] + [AddComponentMenu("Gem/BaseGem")] public class Gem : MonoBehaviour, IGem { [SerializeField] private float _value; + public float Value => _value; public void OnPickup() { diff --git a/Assets/Init/Scripts/Player.cs b/Assets/Init/Scripts/Player.cs index eefcd56..502b088 100644 --- a/Assets/Init/Scripts/Player.cs +++ b/Assets/Init/Scripts/Player.cs @@ -13,10 +13,7 @@ class Player : MonoBehaviour #region Singleton private static Player _instance; - public static Player Instance - { - get { return _instance ? _instance : (_instance = FindObjectOfType()); } - } + public static Player Instance => _instance ? _instance : (_instance = FindObjectOfType()); #endregion @@ -24,7 +21,9 @@ public static Player Instance public void Update() { - transform.position = transform.position + new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0) * Time.deltaTime * _speed; + transform.position = + transform.position + _speed * Time.deltaTime * + new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0); } #endregion @@ -37,9 +36,5 @@ private void OnCollisionEnter2D(Collision2D other) } #endregion - - - - } } \ No newline at end of file