So at the moment when I press fire it carries on firing. I want it so it only fires once and to fire again I would have to press the button again. I have searched for hours and tried various things and also watched many a video but still haven’t a clue. Hopefully its something simple. I have this code attached to an Event Trigger. I keep stumbling across this info but haven’t a clue what to do with it! Arrgghh. Thanks in advance!
using UnityEngine;
using System.Collections;
public class shoot : MonoBehaviour {
public GameObject spaceship;
private MobileShip1Squash MobileShip1Squash;
// Use this for initialization
void Start () {
MobileShip1Squash = spaceship.GetComponent<MobileShip1Squash>();
}
// Update is called once per frame
public void Shoot () {
MobileShip1Squash.shootnumber = 1;
}
public void noShoot () {
MobileShip1Squash.shootnumber = 0;
}
}