|
|
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
-
- public class CharacterMovement : MonoBehaviour {
-
- public float Speed;
-
- //Public movement functions :)
- public void MoveLeft()
- {
- GetComponent<Rigidbody>().AddForce(new Vector3(-Speed, 0.0f, 0.0f));
- }
-
- public void MoveRight()
- {
- GetComponent<Rigidbody>().AddForce(new Vector3(Speed, 0.0f, 0.0f));
- }
-
- public void MoveUp()
- {
- GetComponent<Rigidbody>().AddForce(new Vector3(0.0f, 0.0f, Speed));
- }
-
- public void MoveDown()
- {
- GetComponent<Rigidbody>().AddForce(new Vector3(0.0f, 0.0f, -Speed));
- }
- }
|