This script adds a crosshair texture in the middle of my screen and then hides it if the right mouse button is being held down. Im trying to change the crosshair when the player is sprinting, but Im not sure what to put in my update, can anyone help me out?
var crosshairTexture : Texture2D;
var sprintCrosshairTexture : Texture2D;
var position : Rect;
var rightClick : boolean = true;
function Start(){
position = Rect( ( Screen.width - crosshairTexture.width ) / 2, ( Screen.height - crosshairTexture.height ) / 2, crosshairTexture.width, crosshairTexture.height );
}
function Update() {
if(Input.GetButtonDown("left shift")){
//texture change to sprint texture
}
if(Input.GetButtonUp("left shift")){
//texture change back to normal texture
}
if(Input.GetMouseButtonDown(1)){
rightClick = false;
}
if(Input.GetMouseButtonUp(1)){
rightClick = true;
}
}
function OnGUI(){
if(rightClick){
GUI.DrawTexture(position, crosshairTexture);
}
}