Commit 7cf6460a authored by Unknown's avatar Unknown
Browse files

som small stuff

parent f116ba90
fileFormatVersion: 2
guid: 5782222d4c9b9424ea96676650e643a8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -7,6 +7,8 @@ using _Game.Scripts.Scriptable_Object;
[RequireComponent(typeof(Rigidbody2D), typeof(CapsuleCollider2D))]
public class MovementController : MonoBehaviour
{
[SerializeField] private PlayerState r_State;
[Header("Movement")] [SerializeField] private float m_Speed = 10f;
[SerializeField] private float m_JumpForce = 400f; // Amount of force added when the player jumps.
[SerializeField] private float m_fallMultiplier = 2.5f;
......@@ -59,26 +61,6 @@ public class MovementController : MonoBehaviour
m_Rigidbody2D.gravityScale = state.gravity;
}
public void SetSwimming(bool value)
{
m_Swimming = value;
if (value)
{
OnSwimEvent.Invoke();
m_TempJumpCount = m_MaxJumpCount;
}
}
public bool Swimming
{
get => m_Swimming;
}
public bool Grounded
{
get => m_Grounded;
}
private void Awake()
{
m_Rigidbody2D = GetComponent<Rigidbody2D>();
......@@ -106,6 +88,7 @@ public class MovementController : MonoBehaviour
OnLandEvent.Invoke ();
}
}*/
Vector3 pos = m_GroundCheck.position + new Vector3(m_GroundedOffset.x, m_GroundedOffset.y, 0);
var c = Physics2D.CircleCast(pos, m_GroundedRadius, Vector2.down, m_ContactFilter2D, m_RaycastHits2D,
m_GroundCheckDistance);
......@@ -123,6 +106,8 @@ public class MovementController : MonoBehaviour
}
}
public void Move(Vector2 move, bool jump)
{
//Debug.Log(m_Swimming);
......@@ -175,6 +160,31 @@ public class MovementController : MonoBehaviour
}
}
public void SetSwimming(bool value)
{
m_Swimming = value;
if (value)
{
OnSwimEvent.Invoke();
m_TempJumpCount = m_MaxJumpCount;
}
}
public bool Swimming
{
get => m_Swimming;
}
public bool Grounded
{
get => m_Grounded;
}
public void AddJumpCharge(int amount)
{
m_TempJumpCount += amount;
}
private IEnumerator Wait(float s)
{
m_Jumped = true;
......
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