I am starting with Unity and C# and I got this error:Assets\Challenge 4\Scripts\PlayerControllerX.cs(43,46): error CS1002: ; expected
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerControllerX : MonoBehaviour
{
private Rigidbody playerRb;
private float speed = 500;
private GameObject focalPoint;
public bool hasPowerup;
public GameObject powerupIndicator;
public int powerUpDuration = 5;
private float normalStrength = 10; // how hard to hit enemy without powerup
private float powerupStrength = 25; // how hard to hit enemy with powerup
void Start()
{
playerRb = GetComponent();
focalPoint = GameObject.Find(“Focal Point”);
}
void Update()
{
// Add force to player in direction of the focal point (and camera)
float verticalInput = Input.GetAxis(“Vertical”);
playerRb.AddForce(focalPoint.transform.forward * verticalInput * speed * Time.deltaTime);
// Set powerup indicator position to beneath player
powerupIndicator.transform.position = transform.position + new Vector3(0, -0.6f, 0);
}
// If Player collides with powerup, activate powerup
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag(“Powerup”))
{
Destroy(other.gameObject);
hasPowerup = true;
powerupIndicator.SetActive(true); // 43 line
StartCoroutine(PowerupCooldown())
}
}
// Coroutine to count down powerup duration
IEnumerator PowerupCooldown()
{
yield return new WaitForSeconds(powerUpDuration);
hasPowerup = false;
powerupIndicator.SetActive(false);
}
// If Player collides with enemy
private void OnCollisionEnter(Collision other)
{
if (other.gameObject.CompareTag(“Enemy”))
{
Rigidbody enemyRigidbody = other.gameObject.GetComponent();
Vector3 awayFromPlayer = transform.position - other.gameObject.transform.position;
if (hasPowerup) // if have powerup hit enemy with powerup force
{
enemyRigidbody.AddForce(-awayFromPlayer * powerupStrength, ForceMode.Impulse);
}
else // if no powerup, hit enemy with normal strength
{
enemyRigidbody.AddForce(-awayFromPlayer * normalStrength, ForceMode.Impulse);
}
}
}
}