Add Unity materials and prefabs for game objects for SOLID
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Solid
|
||||
{
|
||||
[RequireComponent(typeof(CharacterController))]
|
||||
public class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float _speed = 10.0f;
|
||||
[SerializeField] private float _rotationSpeed = 60.0f;
|
||||
|
||||
private CharacterController _characterController;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_characterController = GetComponent<CharacterController>();
|
||||
}
|
||||
|
||||
public void MoveAndRotate(Vector2 movement, Vector2 rotation)
|
||||
{
|
||||
transform.Rotate(0, rotation.x * _rotationSpeed * Time.deltaTime, 0);
|
||||
_characterController.Move(new Vector3(movement.x, 0, movement.y) * (_speed * Time.deltaTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user