and my staff this script I did in unity 4 however tava functioning normally now spent for unity 5 and gave enough errors in the console. someone can update this script to me with the changes that happened in Unity5?
#pragma strict
// scripting
var fireplace : GameObject;
var cube : Transform;
var cubeGhost : Transform;
var AuxP : PlayerStats;
var buildSound : AudioClip;
var errSound : AudioClip;
var prefabActiveCube : boolean = false;
var layer : LayerMask;
var foundHit : boolean = false;
function Start()
{
AuxP = GetComponent(“PlayerStats”);
}
function Update ()
{
if(AuxP.Oopk == 10)
{
prefabActiveCube = false;
foundHit = false;
cubeGhost.transform.active = false;
}
if(Input.GetKeyDown(KeyCode.I) && AuxP.Oopk == 1){
foundHit = true;
}
building();
}
function building(){
if(foundHit == true){
var hit : RaycastHit;
foundHit = Physics.Raycast(transform.position, transform.forward, hit, Mathf.Infinity, layer);
prefabActiveCube = true;
if(hit.distance > 20){
cubeGhost.renderer.material.color = Color(1, 0, 0, 0.8);
if(Input.GetMouseButtonDown(0)){
audio.clip = errSound;
audio.Play();
}
}
if(hit.distance < 20){
cubeGhost.renderer.material.color = Color(1, 1, 1, 0.8);
}
if(Input.GetKey(KeyCode.Escape) || Input.GetMouseButtonDown(1)){
prefabActiveCube = false;
foundHit = false;
cubeGhost.active = false;
audio.clip = errSound;
audio.Play();
}
}
if(prefabActiveCube == true){
cubeGhost.position = hit.point;
cubeGhost.active = true;
if(hit.distance < 20){
if(Input.GetKey(KeyCode.E)){
cubeGhost.transform.Rotate(Vector3.up, 60Time.deltaTime);
}
if(Input.GetKey(KeyCode.Q)){
cubeGhost.transform.Rotate(Vector3.down, 60Time.deltaTime);
}
if(Input.GetMouseButtonDown(0))
{
AuxP.Oopk2 = true;
Instantiate(cube, cubeGhost.transform.position, cubeGhost.transform.rotation);
cubeGhost.active = false;
prefabActiveCube = false;
foundHit = false;
audio.clip = buildSound;
audio.Play();
}
}
}
}