Could someone help me with this parsing error I can’t seem to find what is causing it.
using UnityEngine;
using System.Collections;
public class SlimeController : MonoBehaviour {
public float moveSpeed;
private Rigidbody2D myRigidBody;
private bool moving;
public float timeBetweenMoves;
private float timeBetweenMoveCounter;
public float timeToMove;
private float timeToMoveCounter;
private Vector3 moveDirection;
// Use this for initialization
void Start () {
myRigidBody = GetComponent<Rigidbody2D> ();
timeBetweenMoveCounter = timeBetweenMoves;
timeToMoveCounter = timeToMove;
}
// Update is called once per frame
void Update () {
if (moving)
{
timeToMoveCounter -= Time.deltaTime;
myRigidBody.velocity = moveDirection;
if (timeToMoveCounter < 0f)
{
moving = false;
timeBetweenMoveCounter = timeBetweenMoves;
}
//when doing if variables put the values in brackets
} else {
timeBetweenMoveCounter -= Time.deltaTime;
myRigidBody.velocity = Vector2.zero;
if (timeBetweenMoveCounter <0f)
{
moving = true;
timeToMoveCounter = timeToMove;
moveDirection = new Vector3 (Random.Range (-1f, 1f) * moveSpeed, Random.Range (-1f, -1f) * moveSpeed, 0f);
}
}
}