What is this error and why do i keep getting it? I am very new to coding please help. Here is my code :
#pragma strict
//Player Script
//Inspector Variables
var tagName : String;
var rayDistance : float = 100.0 ; //length of ray for the raycast
var score : int = 0; // Score for the player
var gameTime : float = 20; //The time the game will last
var loadWaitTime : float = 1.0; //Amount of time to wait before next scene is loaded
var numberOfPointsToWin : int = 5;
//Private Variables
function Start()
{
InvokeRepeating("CountDown", 1.0, 1.0); //Repeat countdown every second
}
//Update is called every frame
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
var hit : RaycastHit;
var ray : Ray =Camera.main.ScreenPointToRay(Input.mousePosition); //gets mouse position
if(Physics.Raycast(ray, hit, 100.0))
{
if (hit.transform.tag == tagName) {
var enemyScript = hit.transform.GetComponent(ScriptActorEnemy);
enemyScript.numberOfClicks -= 1; //Reduce the number each click
//Checks if object is at 0 for adding points to the score
if(enemyScript.numberOfClicks == 0)
{
score += enemyScript.enemyPoint; //adds points to overall score
}
}
}
}
}
function CountDown()
{ if(--gameTime == 0) //Subtract from gameTime
{
CancelInvoke("CountDown"); //Cancel CountDown at 0
if(score >= numberOfPointsToWin)
{
Application.LoadLevel("sceneScreenWin");
}
else
{
Application.LoadLevel("sceneScreenLose");
}
}
}
//
function OnGUI()
{
GUI.Label(Rect(10,10,100,20),"Score: "+ score);
GUI.Label(Rect(10,25,100,35),"Time: "+ gameTime);
}