0
Help me with my pick up gun scipt guys...
Help me wuth my script i will post it below guys (2 posts)
4 odpowiedzi
+ 3
What's the issue?
0
var TheDistance : float = PlayerCasting.DistanceFromTarget;
var TextDisplay : GameObject;
var FakeGun : GameObject;
var RealGun : GameObject;
var AmmoDisplay : GameObject;
var PickUpAudio : AudioSource;
function Update () {
TheDistance = PlayerCasting.DistanceFromTarget;
if (Input.GetButtonDown("Action")) {
if (TheDistance <= 2 ) {
TakeNineMil();
}
}
}
function OnMouseOver () {
if (TheDistance <= 2 ) {
TextDisplay.GetComponent.<Text>().text = "Take 9mm Pistol";
}
}
function OnMouseExit () {
TextDisplay.GetComponent.<Text>().text = "";
}
function TakeNineMil () {
PickUpAudio.Play();
transform.position = Vector3(0, -1000, 0);
FakeGun.SetActive(false);
RealGun.SetActive(true);
AmmoDisplay.SetActive(true);
}
0
...
0
wait never mind sory for disturbing i figured it out by myself.
it was just a prkblem with the distance.