Files
2020-07-05 10:22:16 -05:00

43 lines
926 B
C#

using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using UnityEngine;
public class Rocket : MonoBehaviour
{
Rigidbody rigidbody;
// Start is called before the first frame update
void Start()
{
rigidbody = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
ProcessInput();
}
private void ProcessInput()
{
if (Input.GetKey(KeyCode.Space))
{
rigidbody.AddRelativeForce(Vector3.up);
}
if (Input.GetKey(KeyCode.A))
{
print("LeftPressed");
transform.Rotate(Vector3.forward);
}
else if (Input.GetKey(KeyCode.D))
{
print("RightPressed");
transform.Rotate(-Vector3.forward);
}
}
}