hi,
i am working on an android racing game, the car script works fine but i have a camera script that swithces between first and third person views. i have one gui texture button that is supposed to switch cameras. the original script was to switch cameras on tab.
original:
var FirstPerson : Camera;
var ThirdPerson : Camera;
var Active : boolean = true;
function Start(){
FirstPerson.enabled = true;
ThirdPerson.enabled = false;
}
function Update(){
if(Input.GetButton("Tab") && Active == false)
{
FirstPerson.enabled = false;
ThirdPerson.enabled = true;
Active = true;
}
else if(Input.GetButton("Tab") && Active == true)
{
FirstPerson.enabled = true;
ThirdPerson.enabled = false;
Active = false;
}
}
what im working on:
var FirstPerson : Camera;
var ThirdPerson : Camera;
var camControl : GUITexture;
var Active : boolean = true;
function Start(){
FirstPerson.enabled = true;
ThirdPerson.enabled = false;
}
function Awake(){
camControl = GameObject.Find("Cameraicon").guiTexture;
}
function Update(){
if (Input.touchCount > 0) {
for (var touch : Touch in Input.touches) && Active == false
{
if (camControl.HitTest (touch.position)) ;
FirstPerson.enabled = false;
ThirdPerson.enabled = true;
//if(Input.GetButton("Tab") && Active == false)
//{
//FirstPerson.enabled = false;
// ThirdPerson.enabled = true;
Active = true;
}
}
else if (Input.touchCount > 0) {
for (var touch : Touch in Input.touches) && Active == true
{
if (camControl.HitTest (touch.position)) ;
FirstPerson.enabled = true;
ThirdPerson.enabled = false;
//else if(Input.GetButton("Tab") && Active == true)
//{
//FirstPerson.enabled = true;
//ThirdPerson.enabled = false;
Active = false;
}}
}
i get a lot of errors, please help