Hi, thanks for the quick answer.
Just to clarify, VS2017 should know of the libraries’ functions I add to the code, right?
BlockquoteI
If you take a look at your screenshot, you’ll see the Thrust method, for example, is missing at least 4 closing curly braces.
Yes, that was me trying to get Visual Studio to behave.
The interesting information there are the products I have installed.
As for the code:
Unity only throws the error CS1525: unexpected symbol, 4 times. Once per square bracket
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rocket : MonoBehaviour
{
Rigidbody rigidBody;
AudioSource audiosource;
// Use this for initialization
void Start()
{
rigidBody = GetComponent<Rigidbody>();
audiosource = GetComponent<AudioSource>();
}
// Update is called once per frame
void Update()
{
ProcessInput();
}
private void ProcessInput()
{
Thrust();
Rotate();
}
void Thrust()
{
if (Input.GetKey(KeyCode.Space))
{
//todo meter botón de superturbo
[SerializeField] int c_Thrust = 250;
rigidBody.AddRelativeForce(c_Thrust * Vector3.up);
if (!audiosource.isPlaying)
{
audiosource.Play();
}
else
{
audiosource.Stop();
}
}
}
void Rotate()
{
[SerializeField] int c_Rotate = 250;
rigidBody.freezeRotation = true; //take manual control of rotation
if (Input.GetKey(KeyCode.A))
{
transform.Rotate(c_Rotate * Time.deltaTime * Vector3.forward);
}
if (Input.GetKey(KeyCode.D))
{
transform.Rotate(c_Rotate * Time.deltaTime * Vector3.back);
}
rigidBody.freezeRotation = false; //resume physics control of rotation
}
}
Thanks in advance!