// Start is called on initialization void Start() { // Get reference to our tank script tankScript = GetComponent <TankScript> (); // Start out with the firing on cooldown fireCooldown = fireFrequency; // Make the tank turn right all the time tankScript.SetTurnSpeed(1); tankScript.SetSpeed(1); }
// Start is called on initialization void Start() { // Get reference to our tank script tankScript = GetComponent<TankScript> (); // Start out with the firing on cooldown fireCooldown = fireFrequency; // Make the tank turn right all the time tankScript.SetTurnSpeed (1); tankScript.SetSpeed (1); }
// Update is called every frame void Update() { // Use horizontal input to set turn speed float x = Input.GetAxis("Horizontal"); tankScript.SetTurnSpeed(x); // Use vertical input to set forward/backward speed float y = Input.GetAxis("Vertical"); tankScript.SetSpeed(y); // If we pressed the fire button, fire! if (Input.GetButtonDown("Fire1")) { tankScript.Fire(); } }