Merge remote-tracking branch 'origin/Over' into Syntriax

This commit is contained in:
2022-02-24 00:23:26 +03:00
5 changed files with 352 additions and 325 deletions

View File

@@ -5,25 +5,49 @@ namespace Platforms
{
public class MovingPlatform : MonoBehaviour, IMovement
{
public float xOffeset;
public float yOffset;
private Rigidbody2D _platformRigidbody;
private Vector3 _velocity = Vector3.zero;
private void Awake()
{
_platformRigidbody = GetComponent<Rigidbody2D>();
}
private void FixedUpdate()
{
if (!IsPaused)
Move(BaseSpeed);
}
// PAUSING METHODS
public bool IsPaused { get; }
public bool IsPaused { get; private set; }
public void Pause()
{
throw new System.NotImplementedException();
IsPaused = true;
_platformRigidbody.simulated = !IsPaused;
}
public void Resume()
{
throw new System.NotImplementedException();
IsPaused = false;
_platformRigidbody.simulated = !IsPaused;
}
// MOVEMENT METHODS
public float BaseSpeed { get; set; }
public void Move(float value)
{
throw new System.NotImplementedException();
var position = transform.position;
var targetPosition = new Vector3(position.x + xOffeset, position.y + yOffset, 0.0f);
position = Vector3.SmoothDamp(position, targetPosition, ref _velocity, 1.0f, 1.0f);
transform.position = position;
}
}
}
}