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